unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Angelo Graziosi <angelo.g0@libero.it>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Error in C++ mode with Emacs 27.0.90
Date: Sat, 28 Mar 2020 23:31:04 +0100 (CET)	[thread overview]
Message-ID: <1222531008.1631683.1585434664266@mail1.libero.it> (raw)
In-Reply-To: <20200328201057.GH7449@ACM>


> 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	other threads:[~2020-03-28 22:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 20:50 Error in C++ mode with Emacs 27.0.90 Angelo Graziosi
2020-03-27 15:56 ` Angelo Graziosi
2020-03-28 15:19   ` Alan Mackenzie
2020-03-28 17:34     ` Angelo Graziosi
2020-03-28 20:10       ` Alan Mackenzie
2020-03-28 22:31         ` Angelo Graziosi [this message]
2020-03-29 11:58           ` Alan Mackenzie
2020-03-29 13:56             ` Eli Zaretskii
2020-03-30 17:49               ` Alan Mackenzie
2020-03-30 18:36                 ` Eli Zaretskii
2020-03-30 19:46                   ` Alan Mackenzie
2020-03-28 23:18         ` Dmitry Gutov
2020-03-29 11:50           ` Alan Mackenzie
2020-03-29 22:32             ` Dmitry Gutov
2020-04-04 11:46               ` Alan Mackenzie
2020-04-04 12:52                 ` Dmitry Gutov
2023-02-18 17:52               ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1222531008.1631683.1585434664266@mail1.libero.it \
    --to=angelo.g0@libero.it \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).