aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2019-11-08 23:40:18 +0000
committerJoão Távora2019-11-09 14:55:42 +0000
commitd9c6b4378ac851f5e730daa0ae36c9ee2d0292fe (patch)
tree33847d366f08fe33a221f66b85256c11b9d21c3f
parent7362554eafd7e255b3d96a4f711e11708dee950f (diff)
downloademacs-d9c6b4378ac851f5e730daa0ae36c9ee2d0292fe.tar.gz
emacs-d9c6b4378ac851f5e730daa0ae36c9ee2d0292fe.zip
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.
-rw-r--r--lisp/minibuffer.el5
1 files changed, 3 insertions, 2 deletions
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."
3496 res 3496 res
3497 (lambda (c1 c2) 3497 (lambda (c1 c2)
3498 (or (equal c1 minibuffer-default) 3498 (or (equal c1 minibuffer-default)
3499 (> (get-text-property 0 'completion-score c1) 3499 (let ((s1 (get-text-property 0 'completion-score c1))
3500 (get-text-property 0 'completion-score c2))))))))) 3500 (s2 (get-text-property 0 'completion-score c2)))
3501 (> (or s1 0) (or s2 0))))))))))
3501 `(metadata 3502 `(metadata
3502 (display-sort-function 3503 (display-sort-function
3503 . ,(compose-flex-sort-fn 3504 . ,(compose-flex-sort-fn