From: João Távora Date: Fri, 8 Nov 2019 23:40:18 +0000 (+0000) Subject: Protect flex's display-sort-function against 0-length candidates X-Git-Tag: emacs-27.0.90~687 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d9c6b4378ac851f5e730daa0ae36c9ee2d0292fe;p=emacs.git Protect flex's display-sort-function against 0-length candidates * lisp/minibuffer.el (completion--flex-adjust-metadata): Assume a candidate missing a score has a score of 0. --- diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index cc113b926f3..5b993e792f0 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3496,8 +3496,9 @@ that is non-nil." res (lambda (c1 c2) (or (equal c1 minibuffer-default) - (> (get-text-property 0 'completion-score c1) - (get-text-property 0 'completion-score c2))))))))) + (let ((s1 (get-text-property 0 'completion-score c1)) + (s2 (get-text-property 0 'completion-score c2))) + (> (or s1 0) (or s2 0)))))))))) `(metadata (display-sort-function . ,(compose-flex-sort-fn