GNU bug report logs -
#70846
Imenu flatten
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 9 May 2024 16:37:01 UTC
Severity: normal
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> This patch revives the feature existed in the initial version of imenu.el,
>> but that was unfortunately removed later.
>>
>> When comparing it with the version in breadcrumb-jump that was discussed in
>> https://lists.gnu.org/archive/html/emacs-devel/2023-12/msg00278.html
>> the advantage of this version is that it doesn't use 'cl-loop':
>
> Thanks. If this is installed, I think it needs a NEWS entry.
So now pushed with a NEWS entry, and also with changes in the manual.
BTW, the manual says in (info "(emacs) Imenu"):
You can customize the way the menus are sorted by setting the
variable ‘imenu-sort-function’. By default, names are ordered as they
occur in the buffer; if you want alphabetic sorting, use the symbol
‘imenu--sort-by-name’ as the value. You can also define your own
comparison function by writing Lisp code.
But imenu-sort-function affects only the mouse popup menu.
To be able to customize sorting of imenu completion candidates
in the minibuffer, another patch is needed that sets a category
for sorting customization:
diff --git a/lisp/imenu.el b/lisp/imenu.el
index f628936cedc..5671b49cdf4 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -733,10 +740,12 @@ imenu--completion-buffer
(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)))
This bug report was last modified 1 year and 42 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.