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: Angelo Graziosi
Subject: Re: Error in C++ mode with Emacs 27.0.90
Date: Sat, 28 Mar 2020 23:31:04 +0100 (CET)

> Il 28 marzo 2020 alle 21.10 Alan Mackenzie ha scritto:
> 
> 
> Hello again, Angelo.
> 
> OK, the problem was imenu-update-menubar's handling of nested imenu
> element lists.  (Somewhat simplified) the function was inadequately
>
> I think the following patch fixes the trouble.  Please try it out and
> report on this list how well it works.  Thanks:

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

Thank you,

  Angelo.

> 
> 
> 
> diff --git a/lisp/imenu.el b/lisp/imenu.el
> index fb8b3de662..7d25c2bf91 100644
> --- a/lisp/imenu.el
> +++ b/lisp/imenu.el
> @@ -911,11 +911,21 @@ 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
> +                        (cond
> +                         ((cddr menu)
> +                          ;; (cdr menu) is a list of len > 1
> +                          menu)
> +                         ((and (consp (cdadr menu))
> +                               ;; POSITION of a "Special element" is an atom:
> +                               (consp (cadadr menu)))
> +                          ;; Discard the enclosing level of the nested list.
> +                          (cadr menu))
> +                         (t             ; Non-nested list of length 1
> +                          menu)))
> +                    'imenu--menubar-select)))
>         (setcdr imenu--menubar-keymap (cdr menu1)))))))
>  
>  (defun imenu--menubar-select (item)
> 
> 
> 
> > Thanks!
> 
> -- 
> Alan Mackenzie (Nuremberg, Germany).



reply via email to

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