From 61d3129cce689f2fc395e864ac55d119f3bd7bf0 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Tue, 25 Feb 2025 16:47:02 +0100 Subject: [PATCH] Fix imenu minibuffer action regression --- lisp/imenu.el | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lisp/imenu.el b/lisp/imenu.el index e1771e9dc94..73063ed2d6c 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -714,19 +714,22 @@ Return one of the entries in index-alist or nil." (cdr item))) index-alist)))) (unless prompt (setq prompt (format-prompt "Index item" nil))) - (when-let ((name (completing-read - prompt - (completion-table-with-metadata - prepared-index-alist - `((category . imenu) - (eager-display . ,imenu-eager-completion-buffer) - ,@(and imenu-flatten - completions-group - `((group-function - . ,(lambda (s transform) - (get-text-property - 0 (if transform 'imenu-base-name 'imenu-section) s))))))) - nil t nil 'imenu--history))) + (when-let ((name (minibuffer-with-setup-hook + (lambda () + (setq-local + completion-extra-properties + `( :category imenu + :eager-display ,imenu-eager-completion-buffer + ,@(and imenu-flatten + completions-group + `(:group-function + ,(lambda (s transform) + (get-text-property + 0 (if transform 'imenu-base-name 'imenu-section) s))))))) + ;; Use a simple alist (rather than a function) as + ;; collection so the minibuffer action can easily + ;; inspect it. + (completing-read prompt prepared-index-alist nil t nil 'imenu--history)))) (setq choice (assoc name prepared-index-alist)) (if (imenu--subalist-p choice) (imenu--completion-buffer (cdr choice) prompt) -- 2.39.5