From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Error in C++ mode with Emacs 27.0.90 Date: Mon, 30 Mar 2020 17:49:38 +0000 Message-ID: <20200330174938.GA6909@ACM> References: <1385091004.1458082.1585083014184@mail1.libero.it> <2124649786.1598258.1585324562989@mail1.libero.it> <20200328151944.GF7449@ACM> <56971920.1649844.1585416890173@mail1.libero.it> <20200328201057.GH7449@ACM> <1222531008.1631683.1585434664266@mail1.libero.it> <20200329115826.GB5469@ACM> <83ftdr5kpb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="125510"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Dmitry Gutov , angelo.g0@libero.it, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 30 19:50:45 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIyYe-000WVH-JG for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Mar 2020 19:50:44 +0200 Original-Received: from localhost ([::1]:54290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIyYd-0006Wh-GN for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Mar 2020 13:50:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38368) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIyXg-0004dI-4N for emacs-devel@gnu.org; Mon, 30 Mar 2020 13:49:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jIyXe-0002gC-Um for emacs-devel@gnu.org; Mon, 30 Mar 2020 13:49:43 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:58483 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1jIyXe-0002dS-Kj for emacs-devel@gnu.org; Mon, 30 Mar 2020 13:49:42 -0400 Original-Received: (qmail 12386 invoked by uid 3782); 30 Mar 2020 17:49:39 -0000 Original-Received: from acm.muc.de (p4FE15DE1.dip0.t-ipconnect.de [79.225.93.225]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 30 Mar 2020 19:49:38 +0200 Original-Received: (qmail 9838 invoked by uid 1000); 30 Mar 2020 17:49:38 -0000 Content-Disposition: inline In-Reply-To: <83ftdr5kpb.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246045 Archived-At: 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 > > Cc: emacs-devel@gnu.org > > > 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).