From: Alan Mackenzie Date: Mon, 30 Mar 2020 19:25:40 +0000 (+0000) Subject: Let imenu to work on the menu bar when its list is a single non-nested member. X-Git-Tag: emacs-27.0.91~48 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=650a664ccd;p=emacs.git 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. --- diff --git a/lisp/imenu.el b/lisp/imenu.el index fb8b3de662b..1949f2f48f7 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)