Consider non-string minibuffer-default in icomplete

Fixes: bug#38992

* lisp/icomplete.el (icomplete--sorted-completions): Consider
non-string minibuffer-default.
This commit is contained in:
João Távora 2020-01-09 10:01:16 +00:00
parent 1fe596d89f
commit eb3c6ad325

View file

@ -448,13 +448,14 @@ Usually run by inclusion in `minibuffer-setup-hook'."
with end = (icomplete--field-end) with end = (icomplete--field-end)
with all = (completion-all-sorted-completions beg end) with all = (completion-all-sorted-completions beg end)
for fn in (cond ((and minibuffer-default for fn in (cond ((and minibuffer-default
(stringp minibuffer-default) ; bug#38992
(= (icomplete--field-end) (icomplete--field-beg))) (= (icomplete--field-end) (icomplete--field-beg)))
;; When we have a non-nil default and no input ;; When we have a non-nil string default and
;; whatsoever: we want to make sure that default ;; no input whatsoever: we want to make sure
;; is bubbled to the top so that ;; that default is bubbled to the top so that
;; `icomplete-force-complete-and-exit' will ;; `icomplete-force-complete-and-exit' will
;; select it (do that even if the match doesn't ;; select it (do that even if the match
;; match the completion perfectly. ;; doesn't match the completion perfectly.
`(,(lambda (comp) `(,(lambda (comp)
(equal minibuffer-default comp)) (equal minibuffer-default comp))
,(lambda (comp) ,(lambda (comp)