From 72e0ef74d0ed242cd75226aef887d87391c23f6d Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 12 Jun 2022 21:24:01 +0300 Subject: [PATCH] * lisp/icomplete.el: Consider a list in minibuffer-default (bug#55800) * lisp/icomplete.el (icomplete--sorted-completions): Handle a string value in the first element of the list of default values in minibuffer-default. --- lisp/icomplete.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 8802e7565f2..be7f6831cc0 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -559,7 +559,8 @@ Usually run by inclusion in `minibuffer-setup-hook'." ;; predicates" which may vary depending on specific ;; `completing-read' invocations, described below: for fn in (cond ((and minibuffer-default - (stringp minibuffer-default) ; bug#38992 + (stringp (or (car-safe minibuffer-default) + minibuffer-default)) ; bug#38992 bug#55800 (equal (icomplete--field-string) icomplete--initial-input)) ;; Here, we have a non-nil string default and ;; no input whatsoever. We want to make sure @@ -577,7 +578,9 @@ Usually run by inclusion in `minibuffer-setup-hook'." ;; Has "bar" at the top, so RET will select ;; it, as desired. ,(lambda (comp) - (equal minibuffer-default comp)) + (equal (or (car-safe minibuffer-default) + minibuffer-default) + comp)) ;; Why do we need this second predicate? ;; Because that'll make things like M-x man ;; RET RET, when invoked with point on the @@ -599,7 +602,9 @@ Usually run by inclusion in `minibuffer-setup-hook'." ;; useful for a very broad spectrum of ;; cases. ,(lambda (comp) - (string-prefix-p minibuffer-default comp)))) + (string-prefix-p (or (car-safe minibuffer-default) + minibuffer-default) + comp)))) ((and fido-mode (not minibuffer-default) (eq (icomplete--category) 'file)) -- 2.39.2