]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix imenu minibuffer action regression
authorEshel Yaron <me@eshelyaron.com>
Tue, 25 Feb 2025 15:47:02 +0000 (16:47 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 25 Feb 2025 15:47:02 +0000 (16:47 +0100)
lisp/imenu.el

index e1771e9dc94ca99478775ce82e4216c6a5e5fa10..73063ed2d6c7b868aae4cc11d026c7a0d49840ee 100644 (file)
@@ -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)