emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-27 650a664: Let imenu to work on the menu bar when its list is a s


From: Alan Mackenzie
Subject: emacs-27 650a664: Let imenu to work on the menu bar when its list is a single non-nested member.
Date: Mon, 30 Mar 2020 15:27:35 -0400 (EDT)

branch: emacs-27
commit 650a664ccd1e801f869f64d441b65db7dcb395f0
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Let imenu to work on the menu bar when its list is a single non-nested 
member.
    
    * lisp/imenu.el (imenu-update-menubar): No longer accept a list of length 1 
as
    being sufficient evidence for a nested list structure.  Instead, 
additionally
    check whether or not certain elements are atoms.
---
 lisp/imenu.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lisp/imenu.el b/lisp/imenu.el
index fb8b3de..1949f2f 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -911,11 +911,15 @@ to `imenu-update-menubar'.")
         (setq index-alist (imenu--split-submenus index-alist))
        (let* ((menu (imenu--split-menu index-alist
                                         (buffer-name)))
-               (menu1 (imenu--create-keymap (car menu)
-                                           (cdr (if (< 1 (length (cdr menu)))
-                                                    menu
-                                                  (car (cdr menu))))
-                                           'imenu--menubar-select)))
+               (menu1 (imenu--create-keymap
+                       (car menu)
+                      (cdr (if (or (< 1 (length (cdr menu)))
+                                    ;; Have we a non-nested single entry?
+                                    (atom (cdadr menu))
+                                    (atom (cadadr menu)))
+                               menu
+                             (car (cdr menu))))
+                      'imenu--menubar-select)))
          (setcdr imenu--menubar-keymap (cdr menu1)))))))
 
 (defun imenu--menubar-select (item)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]