From 234fbf9b2e05c73b6197f4db9e88c694e54a95a2 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 15 Dec 2024 10:57:59 +0100 Subject: [PATCH] completion-eager-display: Handle INITIAL-INPUT cons The INITIAL-ARGUMENT passed to `completing-read' can either be nil, or a string or a pair (STRING . POSITION). Handle each of these three cases. * lisp/minibuffer.el (completing-read-default): Handle cons pair INITIAL-ARGUMENT. --- lisp/minibuffer.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index dfc62c25f38..9a8545c56a6 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -4857,8 +4857,12 @@ completing-read-default ;; `completion-eager-display' is t or if eager display ;; has been requested by the completion table. (when completion-eager-display - (let* ((md (completion-metadata (or initial-input "") - collection predicate)) + (let* ((md (completion-metadata + (pcase initial-input + (`(,str . ,pos) (substring str 0 pos)) + ((pred stringp) initial-input) + (_ "")) + collection predicate)) (fun (completion-metadata-get md 'eager-display))) (when (or fun (eq completion-eager-display t)) (funcall (if (functionp fun) -- 2.45.2