From: Eshel Yaron Date: Fri, 2 Feb 2024 19:09:15 +0000 (+0100) Subject: ; (completing-read-multiple): Add individual inputs to history. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=837f93c75567ffb675321251ebacec5699690f9c;p=emacs.git ; (completing-read-multiple): Add individual inputs to history. --- diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el index 3580c9dfef9..87b6cffffcd 100644 --- a/lisp/emacs-lisp/crm.el +++ b/lisp/emacs-lisp/crm.el @@ -414,17 +414,23 @@ contents of the minibuffer are \"alice,bob,eve\" and point is between This function returns a list of the strings that were read, with empty strings removed." - (let ((crm-current-separator - (if (consp crm-separator) - (car crm-separator) - crm-separator)) - (crm-canonical-separator (cdr-safe crm-separator))) - (split-string - (minibuffer-with-setup-hook - #'completing-read-multiple-mode - (completing-read prompt (apply-partially #'crm--table table) - predicate require-match initial-input hist def inherit-input-method)) - crm-current-separator t))) + (let* ((crm-current-separator + (if (consp crm-separator) + (car crm-separator) + crm-separator)) + (crm-canonical-separator (cdr-safe crm-separator)) + (string (minibuffer-with-setup-hook + #'completing-read-multiple-mode + (completing-read prompt (apply-partially #'crm--table table) + predicate require-match initial-input hist + def inherit-input-method))) + (results (split-string string crm-current-separator t))) + (when-let ((hist-var (and hist (not (eq hist t)) + (if (consp hist) (car hist) hist))) + (hist-list (symbol-value hist))) + (when (string= (car hist-list) string) (pop (symbol-value hist))) + (dolist (res results) (add-to-history hist-var res))) + results)) (provide 'crm)