[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: |
Sun, 29 Mar 2020 11:50:56 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Hello, Dmitry.
On Sun, Mar 29, 2020 at 01:18:13 +0200, Dmitry Gutov wrote:
> Hi Alan,
> On 28.03.2020 22:10, Alan Mackenzie wrote:
> > I think the following patch fixes the trouble. Please try it out and
> > report on this list how well it works
> I wonder if we could rewrite the related code such as not to depend on
> whether a list has one element or several. That sounds ugly. Though the
> change would likely take a fair amount of rework.
It seems unlikely that we can get a nested list (in imenu--index-alist)
with only one element. I have tried creating a C++ buffer with 25
functions in it. This gives a simple list of 25 elements. With 26
functions, I get a nested alist with two elements.
However, in an emacs-lisp-mode buffer, we get things like "Variables"
and "*Rescan*", but I've not yet succeeded in causing a nested list with
just one element. I'm not convinced enough that it couldn't happen,
though.
The latter part of the function looks like this (before my patch):
(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)))
(setcdr imenu--menubar-keymap (cdr menu1)))))))
That `if' form has been there since imenu-update-menubar was first
written by Karl Heuer in 1997 (commit 0a8e8bc63e3). Presumably, it
really was needed back then.
> In any case, imenu--create-keymap is also called from imenu--mouse-menu,
> which probably needs the same kind of fix.
Possibly. I've not managed to create the same error in
imenu--mouse-menu, but perhaps it could do with the same correction,
just in case. What do you think?
Incidentally, that patch from last night was a bit untidy. I think it
needs cleaning up a bit.
--
Alan Mackenzie (Nuremberg, Germany).
- Error in C++ mode with Emacs 27.0.90, Angelo Graziosi, 2020/03/24
- Re: Error in C++ mode with Emacs 27.0.90, Angelo Graziosi, 2020/03/27
- Re: Error in C++ mode with Emacs 27.0.90, Alan Mackenzie, 2020/03/28
- Re: Error in C++ mode with Emacs 27.0.90, Angelo Graziosi, 2020/03/28
- Re: Error in C++ mode with Emacs 27.0.90, Alan Mackenzie, 2020/03/28
- Re: Error in C++ mode with Emacs 27.0.90, Angelo Graziosi, 2020/03/28
- Re: Error in C++ mode with Emacs 27.0.90, Alan Mackenzie, 2020/03/29
- Re: Error in C++ mode with Emacs 27.0.90, Eli Zaretskii, 2020/03/29
- Re: Error in C++ mode with Emacs 27.0.90, Dmitry Gutov, 2020/03/28
- Re: Error in C++ mode with Emacs 27.0.90,
Alan Mackenzie <=
- Re: Error in C++ mode with Emacs 27.0.90, Dmitry Gutov, 2020/03/29