]> git.eshelyaron.com Git - emacs.git/commitdiff
Support customization of sorting order for Imenu completion candidates
authorJuri Linkov <juri@linkov.net>
Fri, 10 May 2024 16:45:21 +0000 (19:45 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sun, 12 May 2024 15:48:42 +0000 (17:48 +0200)
* lisp/imenu.el (imenu--completion-buffer):
Set completion-extra-properties to '(:category imenu).
(imenu--flatten-index-alist): Use imenu--subalist-p to handle
newer format (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...)
as well (bug#70846).

* doc/emacs/misc.texi (DocView Navigation): Fix typo.

(cherry picked from commit 5d8c2bad21cc647b3462acfe8e970419354cde83)

doc/emacs/misc.texi
lisp/imenu.el

index 04e6138b692c97ecb36afc039feb2dd6c3990c8c..3bee88bca860406c0c2e4b8c40d85a8751c79ffe 100644 (file)
@@ -590,7 +590,7 @@ even when @command{mutool} can be found on your system, customize the
 variable @code{doc-view-imenu-enabled} to the @code{nil} value.  You
 can further customize how @code{imenu} items are formatted and
 displayed using the variables @code{doc-view-imenu-format} and
-@code{doc-view-flatten}.
+@code{doc-view-imenu-flatten}.
 
 @node DocView Searching
 @subsection DocView Searching
index dd924b449cfd631d39946118ea46544259f5fd37..9c0c1ae144e35dbc98d4427eefe1f9edc8e746fc 100644 (file)
@@ -740,10 +740,12 @@ Return one of the entries in index-alist or nil."
                          (imenu--in-alist name prepared-index-alist)
                          ;; Default to `name' if it's in the alist.
                          name))))
-    (let ((minibuffer-setup-hook minibuffer-setup-hook))
-      ;; Display the completion buffer.
-      (if (not imenu-eager-completion-buffer)
-         (add-hook 'minibuffer-setup-hook 'minibuffer-completion-help))
+    ;; Display the completion buffer.
+    (minibuffer-with-setup-hook
+        (lambda ()
+          (setq-local completion-extra-properties '(:category imenu))
+          (unless imenu-eager-completion-buffer
+            (minibuffer-completion-help)))
       (setq name (completing-read prompt
                                  prepared-index-alist
                                  nil t nil 'imenu--history-list name)))
@@ -784,7 +786,7 @@ Returns t for rescan and otherwise an element or subelement of INDEX-ALIST."
                                 (concat prefix imenu-level-separator name)
                               name))))
        (cond
-       ((or (markerp pos) (numberp pos))
+       ((not (imenu--subalist-p item))
         (list (cons new-prefix pos)))
        (t
         (imenu--flatten-index-alist pos concat-names new-prefix)))))