emacs-devel
[Top][All Lists]
Advanced

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

Re: Error in C++ mode with Emacs 27.0.90


From: Alan Mackenzie
Subject: Re: Error in C++ mode with Emacs 27.0.90
Date: Mon, 30 Mar 2020 17:49:38 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, Eli.

On Sun, Mar 29, 2020 at 16:56:00 +0300, Eli Zaretskii wrote:
> > Date: Sun, 29 Mar 2020 11:58:26 +0000
> > From: Alan Mackenzie <address@hidden>
> > Cc: address@hidden

> > > Yes, it works! I tested it on master so I think it should be backported
> > > to Emacs-27

> > Thanks!

> > Is it really important enough for Emacs 27?  It only happens in a file
> > with one single function, and even then, if I understand it right, it
> > doesn't prevent the user adding another function and carrying on with his
> > work.

> > Anyhow, Eli would need to give his permission before we could add it to
> > Emacs 27.

> I might, if you make the change less different from the current code
> (the 'length > 1' vs cddr).  If the change is just an addition, then
> I'm probably okay with it.

OK, let's see!  The following patch, in place of the original patch, is
a minimal patch, although fundamentally the same as the one I first
posted here:



diff --git a/lisp/imenu.el b/lisp/imenu.el
index fb8b3de662..1949f2f48f 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -911,11 +911,15 @@ 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)


Should I commit this to the emacs-27 release branch?

> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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