Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 57996) by debbugs.gnu.org; 5 Oct 2022 13:58:30 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 05 09:58:30 2022 Received: from localhost ([127.0.0.1]:57750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1og4ur-0001D5-Js for submit <at> debbugs.gnu.org; Wed, 05 Oct 2022 09:58:30 -0400 Received: from mail-pf1-f174.google.com ([209.85.210.174]:34467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <checker@HIDDEN>) id 1og4un-0001Cq-Te for 57996 <at> debbugs.gnu.org; Wed, 05 Oct 2022 09:58:27 -0400 Received: by mail-pf1-f174.google.com with SMTP id f140so10631792pfa.1 for <57996 <at> debbugs.gnu.org>; Wed, 05 Oct 2022 06:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=d6-com.20210112.gappssmtp.com; s=20210112; h=mime-version:user-agent:reply-to:references:in-reply-to:message-id :date:cc:subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=WGCEzUKdjvAfzlZSFeLaRx8BbW2RS/WgwmfPQjDukE0=; b=Fjf9airwRFpO8u9kGuLnU0KzkbZ7zD8kf6S1wV8cXM9NxQ1y/DNq68bzCJjRZ/3EEY cFc50OPuvfEPL/zO7RO4v/lUIzxeU6qA4UMPzXxWquiLb1REhWghslzK8nt5fjn4IvTi ypKGlACS1QeNRs4tz5jKspql/P4f6kdGJA9BjTyx64XiHx1JyI8g3TmChjUgqYcxkmPq ZbxAQtyzkbgygEfL3OmIF/nBh/xM59siId2M3Ad0BOcLpQBhK+kIDrmCsIn1+iE+XJCF FSleX8/X6PYTRIflNprlZahBHHNa74EBv0TQi3/fnSAagFCGeJsyAr3Fj68dYSZl6Qpu 1/Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:reply-to:references:in-reply-to:message-id :date:cc:subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WGCEzUKdjvAfzlZSFeLaRx8BbW2RS/WgwmfPQjDukE0=; b=kV7nbKs6wXW2phUqhP9rDnHvN21Oic5CFtHPJ3wjCP8aLD6ViA7/923YZoSzrP7Kmt EgdGy9xyudaHh61uttnEQwNaCp9/raBMyfYWqSJUMri9rj9Hx7+dPp6xQaCOgdCmRPx/ dla4c7vEEoY4gx61/K+CAs3h+hECktWx6ldqe1rYvi9/TzJBBlHgzGxaPeR5HnkfGP4b nBQzMiVRrI/xGkeTy7QA2gqmilMzZaDGg+Vz6c5Xlx5A6s0s986uFWvh6CFuOnJsv/li QIYrjDFZSe7wfbiS44Z02e+HTF132rj50szhukOLJOnyqsthGEYjs/dsOYNqcBVYkCAD EmrQ== X-Gm-Message-State: ACrzQf1EZSWA+vewKoQSKr82U3IEREclPz+c9J6AC5gDchI6jnSRaHiw KKpY3QWfLDCefDCAyqUyB3vpTw== X-Google-Smtp-Source: AMsMyM7+s9GdH8hMWs9fXZoLj+rSEqqV9nVPsP7BOpbNIaJ6oz/g9bpLiI7RdgSW/lrqC3sfy/uw2g== X-Received: by 2002:a63:83c8:0:b0:44c:94b3:6a3a with SMTP id h191-20020a6383c8000000b0044c94b36a3amr4016pge.142.1664978299930; Wed, 05 Oct 2022 06:58:19 -0700 (PDT) Received: from [192.168.1.217] (157-131-207-86.fiber.dynamic.sonic.net. [157.131.207.86]) by smtp.gmail.com with ESMTPSA id v20-20020a170902f0d400b00176cdd7e4c6sm10537214pla.50.2022.10.05.06.58.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Oct 2022 06:58:19 -0700 (PDT) From: "Chris Hecker" <checker@HIDDEN> To: "Alan Mackenzie" <acm@HIDDEN>, "Philip Kaludercic" <philipk@HIDDEN> Subject: Re[5]: bug#57996: 28.2; imenu doesn't differentiate overloaded c++ functions Date: Wed, 05 Oct 2022 13:58:18 +0000 Message-Id: <ema18f8f3a-3143-4aa3-851a-9eb5d7b6bc9b@checker-blade15> In-Reply-To: <em4fbafb1d-f170-4534-aa45-db388d1a7f37@checker-blade15> References: <em9dbf9c23-ed96-4c46-88c5-cdd300b87fee@checker-blade15> <87v8p22wsz.fsf@HIDDEN> <Yz1c721Ohisf5909@acm> <emd474b896-1b01-4a2a-8d44-d43f17d7634c@checker-blade15> <em35cdca27-cc1a-4e4c-8971-4df43aab68b1@checker-blade15> <em4fbafb1d-f170-4534-aa45-db388d1a7f37@checker-blade15> User-Agent: eM_Client/8.2.1721.0 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------=_MB06998888-894C-417D-A1E9-F40006E2D59F" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 57996 Cc: 57996 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: Chris Hecker <checker@HIDDEN> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --------=_MB06998888-894C-417D-A1E9-F40006E2D59F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Er, wait, this won't handle nested alists, I'll fix it tomorrow. Chris ------ Original Message ------ From: "Chris Hecker" <checker@HIDDEN> To: "Alan Mackenzie" <acm@HIDDEN>; "Philip Kaludercic"=20 <philipk@HIDDEN> Cc: 57996 <at> debbugs.gnu.org Sent: 2022-10-05 06:45:05 Subject: Re[4]: bug#57996: 28.2; imenu doesn't differentiate overloaded=20 c++ functions > >Okay, I figured out a way to do this that works pretty easily, and the=20 >same idea could be integrated into imenu fairly trivially: > >>(defun checker-imenu-make-unique-alist (index-alist) >> "De-duplicate the imenu alist by adding indices to duplicate names." >> (let ((h (make-hash-table :test #'equal))) >> (mapc (lambda (el) >> (let* ((k (car el)) >> (v (gethash k h))) >> (if v >> (let ((n (car v))) >> (if (=3D n 1) >> (setcar (car (cdr v)) (format "%s(1)" k))) >> (setq n (1+ n)) >> (puthash k '(n nil) h) >> (setcar el (format "%s(%d)" k n))) >> (puthash k (list 1 el) h)))) >> index-alist))) >>(advice-add 'imenu--truncate-items :filter-return=20 >>#'checker-imenu-make-unique-alist) > >So this just hooks the imenu--truncate-items function because it was=20 >the easiest function that was hookable on the pre-cached side of the=20 >code (meaning it doesn't get called every imenu, just on *rescan*). It=20 >puts the function names in a hash, and if they are dupes, it puts (n)=20 >after the name. Works great. > >Chris > > > >------ Original Message ------ >From: "Chris Hecker" <checker@HIDDEN> >To: "Alan Mackenzie" <acm@HIDDEN>; "Philip Kaludercic"=20 ><philipk@HIDDEN> >Cc: 57996 <at> debbugs.gnu.org >Sent: 2022-10-05 04:15:12 >Subject: Re[3]: bug#57996: 28.2; imenu doesn't differentiate overloaded=20 >c++ functions > >> >>Hmm... >> >>item is selected by the user. This function is called with >>arguments consisting of the item name, the buffer position, and >>the ARGUMENTS. >> >>This looks like it might work... I just opened my .emacs and found=20 >>I'd already hacked my own version of the c++ matching function, so=20 >>maybe I'll try this. >> >>A few minutes later... >> >>Okay, so this function does indeed get called, but both Function=20 >>elements in the imenu list pass the marker for the first Function, so=20 >>that's unfortunate... I will look at that... >> >>Another few minutes... >> >>Well, it looks like imenu--generic-function generates the right alist=20 >>with the two functions and the two different markers, so it's=20 >>something about choosing in the buffer... >> >>Here's the alist return, looks good: >> >>(("Function" . #<marker at 2 in c.cpp>) >> ("Function" . #<marker at 41 in c.cpp>) >> ("Bar" . #<marker at 95 in c.cpp>)) >> >>I should sleep, but maybe there's just a bug in the code that selects=20 >>the function, or it searches by name instead of by index. I wish=20 >>there was some way for the regex match to return a mangled name...I'll=20 >>look into imenu next. >> >>Chris >> >>------ Original Message ------ >>From: "Chris Hecker" <checker@HIDDEN> >>To: "Alan Mackenzie" <acm@HIDDEN>; "Philip Kaludercic"=20 >><philipk@HIDDEN> >>Cc: 57996 <at> debbugs.gnu.org >>Sent: 2022-10-05 03:47:06 >>Subject: Re[2]: bug#57996: 28.2; imenu doesn't differentiate=20 >>overloaded c++ functions >> >>> >>>Yeah, I should probably switch to something a little more modern, but=20 >>>imenu has the advantage of just being there and working most of the=20 >>>time across all machines and shells and stuff. It definitely gets=20 >>>confused occasionally (like it doesn't find inline functions in class=20 >>>declarations) but this overload thing seemed like it might be a=20 >>>simple fix. >>> >>> >>>The scanning interface to imenu allows just function names to be >>>collected. It doesn't allow anything extra (such as a line number) to >>>be included into the alist. >>> >>>I guess you could mangle the name to include the line number or match=20 >>>number...kinda hacky but it'd work...maybe I'll take a look. >>> >>>Chris >>> >>> >>>------ Original Message ------ >>>From: "Alan Mackenzie" <acm@HIDDEN> >>>To: "Philip Kaludercic" <philipk@HIDDEN> >>>Cc: "Chris Hecker" <checker@HIDDEN>; 57996 <at> debbugs.gnu.org >>>Sent: 2022-10-05 03:31:11 >>>Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded=20 >>>c++ functions >>> >>>>Hello, Chris and Philip. >>>> >>>>On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Kaludercic wrote: >>>>> "Chris Hecker" <checker@HIDDEN> writes: >>>> >>>>> > With this dumb c++ file: >>>>> > ---- >>>>> > int Function( int n ) { >>>>> > return n; >>>>> > } >>>>> > int Function( float v ) { >>>>> > return (int)(v + 0.5); >>>>> > } >>>>> > ---- >>>> >>>>> > Hitting imenu only gives a single Function entry. It should proba= bly >>>>> > give two, maybe with a line number after them like "Function(123)" = or >>>>> > whatever. Currently there's no way to get to the second Function= from >>>>> > imenu. >>>> >>>>imenu is old and rather simplistic. It parses a buffer, then stores th= e >>>>results in an association list. It then uses the function assoc on tha= t >>>>list to get "the" match. What we could do with is a function which get= s >>>>_all_ the matches from an alist, and I've asked on emacs-devel about >>>>this. >>>> >>>>> Note that this is not the case when using Eglot and a LSP server lik= e >>>>> clangd. >>>> >>>>Much more modern! >>>> >>>>> I've CC'ed Alan to see if he knows how this could be done by c++-mod= e >>>>> itself. >>>> >>>>I'm pretty sure it couldn't be. I think it would involve enhancing >>>>imenu. The scanning interface to imenu allows just function names to b= e >>>>collected. It doesn't allow anything extra (such as a line number) to >>>>be included into the alist. >>>> >>>>I've looked at problems with imenu in C++ Mode before, but got bogged >>>>down without coming up with a workable solution. There the problem was >>>>identically named methods in different classes, or something like that. >>>> >>>>So, maybe we can enhance imenu. But not for Emacs 29. >>>> >>>>-- >>>>Alan Mackenzie (Nuremberg, Germany). --------=_MB06998888-894C-417D-A1E9-F40006E2D59F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head><style id=3D"pgp_css" type=3D"text/css"><!----></style><style t= ype=3D"text/css"><!--#x124d40f3ca7748c blockquote.cite {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right: 0p= x; border-left: 1px solid rgb(204, 204, 204);} #x124d40f3ca7748c blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right: 0p= x; border-left: 1px solid rgb(204, 204, 204); margin-top: 3px; padding-top: = 0px;} #x124d40f3ca7748c {font-family: "Segoe UI"; font-size: 12pt;} --></style><style id=3D"css_styles" type=3D"text/css"><!--blockquote.cite { = margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px= ; border-left: 1px solid #cccccc } blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px;= padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding= -top: 0px; } a img { border: 0px; } li[style=3D'text-align: center;'], li[style=3D'text-align: center; '], li[s= tyle=3D'text-align: right;'], li[style=3D'text-align: right; '] { list-sty= le-position: inside;} body { font-family: Segoe UI; font-size: 12pt; }=20 .quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb soli= d; padding-left: 0.3em; }--></style></head><body><div><br /></div><div>Er,= wait, this won't handle nested alists, I'll fix it tomorrow.</div><div><br= /></div><div>Chris</div><div><br /></div> <div><br /></div> <div>------ Original Message ------</div> <div>From: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@d6.= com</a>></div> <div>To: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a>&= gt;; "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">philipk@= posteo.net</a>></div> <div>Cc: <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</a>= </div> <div>Sent: 2022-10-05 06:45:05</div> <div>Subject: Re[4]: bug#57996: 28.2; imenu doesn't differentiate overloade= d c++ functions</div><div><br /></div> <div id=3D"x124d40f3ca7748c"><blockquote cite=3D"em4fbafb1d-f170-4534-aa45-= db388d1a7f37@checker-blade15" type=3D"cite" class=3D"cite2"> <div><br /></div><div>Okay, I figured out a way to do this that works prett= y easily, and the same idea could be integrated into imenu fairly trivially= :</div><div><br /></div><blockquote style=3D"margin: 0 0 0 40px; border: no= ne; padding: 0px;"><div>(defun checker-imenu-make-unique-alist (index-alist= ) </div><div>=C2=A0 "De-duplicate the imenu alist by adding indices to duplic= ate names." </div><div>=C2=A0 (let ((h (make-hash-table :test #'equal))) </div><div>=C2=A0 =C2=A0 (mapc (lambda (el) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let* ((k (car el)) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(v (gethash k h))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if v </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= let ((n (car v))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (if (=3D n 1) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (setcar (car (cdr v)) (format "%s(1)" k))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (setq n (1+ n)) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (puthash k '(n nil) h) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (setcar el (format "%s(%d)" k n))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (puthash = k (list 1 el) h)))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 index-alist))) </div><div>(advice-add 'imenu--truncate-items :filter-return #'checker-imen= u-make-unique-alist) </div></blockquote><div><br /></div><div>So this just hooks the imenu--trun= cate-items function because it was the easiest function that was hookable o= n the pre-cached side of the code (meaning it doesn't get called every imen= u, just on *rescan*).=C2=A0 It puts the function names in a hash, and if th= ey are dupes, it puts (n) after the name.=C2=A0 Works great.</div><div><br= /></div><div>Chris</div><div><br /></div><div><br /></div> <div><br /></div> <div>------ Original Message ------</div> <div>From: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@d6.= com</a>></div> <div>To: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a>&= gt;; "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">philipk@= posteo.net</a>></div> <div>Cc: <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</a>= </div> <div>Sent: 2022-10-05 04:15:12</div> <div>Subject: Re[3]: bug#57996: 28.2; imenu doesn't differentiate overloade= d c++ functions</div><div><br /></div> <div id=3D"xfeaa62b925fd48c"><blockquote type=3D"cite" class=3D"cite2"> <div><br /></div><div>Hmm...</div><div></div> <div><br /><div><div id=3D"xa7b59288d32a4b05a06a858fcd513fd3"><div>item is= selected by the user.=C2=A0 This function is called with </div><div>arguments consisting of the item name, the buffer position, and </div><div>the ARGUMENTS.</div></div></div><div><br /></div><div>This looks = like it might work...=C2=A0 I just opened my .emacs and found I'd already= hacked my own version of the c++ matching function, so maybe I'll try this.= </div><div><br /></div><div>A few minutes later...</div><div><br /></div><d= iv>Okay, so this function does indeed get called, but both Function element= s in the imenu list pass the marker for the first Function, so that's unfor= tunate...=C2=A0 I will look at that...</div><div><br /></div><div>Another f= ew minutes...</div><div><br /></div><div>Well, it looks like imenu--generic= -function generates the right alist with the two functions and the two diff= erent markers, so it's something about choosing in the buffer...</div><div>= <br /></div><div>Here's the alist return, looks good:</div><div></div><div>= <br /><div><div id=3D"xa1297727881c4d348172e3b8263e7e6a"><div>(("Function"= . #<marker at 2 in c.cpp>) </div><div>=C2=A0("Function" . #<marker at 41 in c.cpp>) </div><div>=C2=A0("Bar" . #<marker at 95 in c.cpp>)) </div><div></div></div></div></div><div><br /></div><div>I should sleep, bu= t maybe there's just a bug in the code that selects the function, or it sea= rches by name instead of by index.=C2=A0 =C2=A0I wish there was some way fo= r the regex match to return a mangled name...I'll look into imenu next.</di= v><div><br /></div><div>Chris</div><div><br /></div><div><div id=3D"xa7b592= 88d32a4b05a06a858fcd513fd3"><div> </div><div></div></div></div></div> <div>------ Original Message ------</div> <div>From: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@d6.= com</a>></div> <div>To: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a>&= gt;; "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">philipk@= posteo.net</a>></div> <div>Cc: <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</a>= </div> <div>Sent: 2022-10-05 03:47:06</div> <div>Subject: Re[2]: bug#57996: 28.2; imenu doesn't differentiate overloade= d c++ functions</div><div><br /></div> <div id=3D"xb10dd9c9c00a421"><blockquote type=3D"cite" class=3D"cite2"> <div><br /></div><div>Yeah, I should probably switch to something a little= more modern, but imenu has the advantage of just being there and working mo= st of the time across all machines and shells and stuff.=C2=A0 It definitel= y gets confused occasionally (like it doesn't find inline functions in clas= s declarations) but this overload thing seemed like it might be a simple fi= x.</div><div><br /></div><div><br /><div><div id=3D"x76222cf8bd0c4b028ef0b4= 0bc9c5c682"><div class=3D"plain_line">The scanning interface to imenu allow= s just function names to be</div> <div class=3D"plain_line">collected. It doesn't allow anything extra (such = as a line number) to</div> <div class=3D"plain_line">be included into the alist.</div></div></div><div= ><br /></div></div><div>I guess you could mangle the name to include the li= ne number or match number...kinda hacky but it'd work...maybe I'll take a l= ook.</div><div><br /></div><div>Chris</div><div><br /></div> <div><br /></div> <div>------ Original Message ------</div> <div>From: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a= >></div> <div>To: "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">phil= ipk@HIDDEN</a>></div> <div>Cc: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@HIDDEN= m</a>>; <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</= a></div> <div>Sent: 2022-10-05 03:31:11</div> <div>Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded c= ++ functions</div><div><br /></div> <div id=3D"x11f6bb6266934aa"><blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line">Hello, Chris and Philip.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Ka= ludercic wrote:</div> <blockquote type=3D"cite" class=3D"cite"> <div class=3D"plain_line"> "Chris Hecker" <<a href=3D"mailto:checker@d6.= com">checker@HIDDEN</a>> writes:</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> > With this dumb c++ file:</div> <div class=3D"plain_line"> > ----</div> <div class=3D"plain_line"> > int Function( int n ) {</div> <div class=3D"plain_line"> > return n;</div> <div class=3D"plain_line"> > }</div> <div class=3D"plain_line"> > int Function( float v ) {</div> <div class=3D"plain_line"> > return (int)(v + 0.5);</div> <div class=3D"plain_line"> > }</div> <div class=3D"plain_line"> > ----</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> > Hitting imenu only gives a single Function= entry. It should probably</div> <div class=3D"plain_line"> > give two, maybe with a line number after th= em like "Function(123)" or</div> <div class=3D"plain_line"> > whatever. Currently there's no way to get= to the second Function from</div> <div class=3D"plain_line"> > imenu.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">imenu is old and rather simplistic. It parses a= buffer, then stores the</div> <div class=3D"plain_line">results in an association list. It then uses the = function assoc on that</div> <div class=3D"plain_line">list to get "the" match. What we could do with i= s a function which gets</div> <div class=3D"plain_line">_all_ the matches from an alist, and I've asked o= n emacs-devel about</div> <div class=3D"plain_line">this.</div> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> Note that this is not the case when using Eglot= and a LSP server like</div> <div class=3D"plain_line"> clangd.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">Much more modern!</div> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> I've CC'ed Alan to see if he knows how this coul= d be done by c++-mode</div> <div class=3D"plain_line"> itself.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">I'm pretty sure it couldn't be. I think it would = involve enhancing</div> <div class=3D"plain_line">imenu. The scanning interface to imenu allows ju= st function names to be</div> <div class=3D"plain_line">collected. It doesn't allow anything extra (such = as a line number) to</div> <div class=3D"plain_line">be included into the alist.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">I've looked at problems with imenu in C++ Mode be= fore, but got bogged</div> <div class=3D"plain_line">down without coming up with a workable solution. = There the problem was</div> <div class=3D"plain_line">identically named methods in different classes, o= r something like that.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">So, maybe we can enhance imenu. But not for Emac= s 29.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">--</div> <div class=3D"plain_line">Alan Mackenzie (Nuremberg, Germany).</div> </blockquote></div> </blockquote></div> </blockquote></div> </blockquote></div> </body></html> --------=_MB06998888-894C-417D-A1E9-F40006E2D59F--
bug-gnu-emacs@HIDDEN
:bug#57996
; Package emacs
.
Full text available.Received: (at 57996) by debbugs.gnu.org; 5 Oct 2022 13:45:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 05 09:45:15 2022 Received: from localhost ([127.0.0.1]:56338 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1og4i2-0007Up-Cu for submit <at> debbugs.gnu.org; Wed, 05 Oct 2022 09:45:15 -0400 Received: from mail-pl1-f180.google.com ([209.85.214.180]:42982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <checker@HIDDEN>) id 1og4hz-00073s-Th for 57996 <at> debbugs.gnu.org; Wed, 05 Oct 2022 09:45:13 -0400 Received: by mail-pl1-f180.google.com with SMTP id c24so5370236pls.9 for <57996 <at> debbugs.gnu.org>; Wed, 05 Oct 2022 06:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=d6-com.20210112.gappssmtp.com; s=20210112; h=mime-version:user-agent:reply-to:references:in-reply-to:message-id :date:cc:subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=rg0RkM2s5oA4umscQGTHW4fJwJrkYC5A9x/vWahj95o=; b=PZcmHx5WtEAENb9W/lOwuGJtfnB8+az73kSut/85VfmvLdRQXrCQSMtDvfjKNKT9yC 43l/y0/95kF7Hq7EyTFK8v+E4lEIIzT5y4BzlSqjIaGFLeBgqKRpF4Mfvg6mDZf00pie ZT29LLWwIdPylPyo9E52xFmHkgndyUNDO0STq9dfz7BLynhrPsF4PdYYL18ex/7e3+7a hQRs+mBn/KAUL7DuOJioKugAVIKFDIFYHgtsWsj8is/8RFrg7Pz25P9uFu0pLRCHjfVS MS4EcnhGfpWWmJO1V8HVTy4ZiAWagGuhu9NH5ZTozl54YTzROENU2rZLweEOI7C9n98V uY+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:reply-to:references:in-reply-to:message-id :date:cc:subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rg0RkM2s5oA4umscQGTHW4fJwJrkYC5A9x/vWahj95o=; b=X0ktJFF1OFXbd3CXioggvtnInb0W+DvM61YDFmjBqyUmflhSL+vhY8wbIWVRiSW8i6 RYeerbPjVmzkcsB/b4DPSCSjPbrjcrs/th2VEOq/isGAAjzqPt+VLB0z9FUjvaxKYq5Y icUiwF9YU2EMXw3hAwIyndafeHc6LnzZw+r04q48gTsK9pINuIqaYlmGrpDk0L74UIqG oV0qObkcbHKzM3BMjwwopDqK+foKK5kcAf2pX9iAOnoIQiyUU4pHX+XXi6WRM5BZUySH CQ3TcSKio8XRS2/jJo9tNrpw/EIpp07iN7SRhNycywyKD5iJV38IBWBxGWWC8HlZjxxk ehpQ== X-Gm-Message-State: ACrzQf1RSYRCvtRyiDpAMOz+6ZYkDuN9FLiPSyJkz8fmGSek65UzW8p8 UKkh2XssLmAlnwlPUwwuWTC8dQ== X-Google-Smtp-Source: AMsMyM6c88AMPKBJC7Fi0ucZRQx214hL4FvgEBrSlSiBrw5bzVCXH3Bs110Rtg9KgE9e75aHoxd9MQ== X-Received: by 2002:a17:902:720b:b0:178:83e9:11ec with SMTP id ba11-20020a170902720b00b0017883e911ecmr31452360plb.34.1664977505900; Wed, 05 Oct 2022 06:45:05 -0700 (PDT) Received: from [192.168.1.217] (157-131-207-86.fiber.dynamic.sonic.net. [157.131.207.86]) by smtp.gmail.com with ESMTPSA id bi4-20020a170902bf0400b0017f75654a33sm2722048plb.73.2022.10.05.06.45.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Oct 2022 06:45:05 -0700 (PDT) From: "Chris Hecker" <checker@HIDDEN> To: "Alan Mackenzie" <acm@HIDDEN>, "Philip Kaludercic" <philipk@HIDDEN> Subject: Re[4]: bug#57996: 28.2; imenu doesn't differentiate overloaded c++ functions Date: Wed, 05 Oct 2022 13:45:05 +0000 Message-Id: <em4fbafb1d-f170-4534-aa45-db388d1a7f37@checker-blade15> In-Reply-To: <em35cdca27-cc1a-4e4c-8971-4df43aab68b1@checker-blade15> References: <em9dbf9c23-ed96-4c46-88c5-cdd300b87fee@checker-blade15> <87v8p22wsz.fsf@HIDDEN> <Yz1c721Ohisf5909@acm> <emd474b896-1b01-4a2a-8d44-d43f17d7634c@checker-blade15> <em35cdca27-cc1a-4e4c-8971-4df43aab68b1@checker-blade15> User-Agent: eM_Client/8.2.1721.0 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------=_MB82838367-B5F7-4DA9-BD2E-734761B5C01C" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 57996 Cc: 57996 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: Chris Hecker <checker@HIDDEN> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --------=_MB82838367-B5F7-4DA9-BD2E-734761B5C01C Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Okay, I figured out a way to do this that works pretty easily, and the=20 same idea could be integrated into imenu fairly trivially: >(defun checker-imenu-make-unique-alist (index-alist) > "De-duplicate the imenu alist by adding indices to duplicate names." > (let ((h (make-hash-table :test #'equal))) > (mapc (lambda (el) > (let* ((k (car el)) > (v (gethash k h))) > (if v > (let ((n (car v))) > (if (=3D n 1) > (setcar (car (cdr v)) (format "%s(1)" k))) > (setq n (1+ n)) > (puthash k '(n nil) h) > (setcar el (format "%s(%d)" k n))) > (puthash k (list 1 el) h)))) > index-alist))) >(advice-add 'imenu--truncate-items :filter-return=20 >#'checker-imenu-make-unique-alist) So this just hooks the imenu--truncate-items function because it was the=20 easiest function that was hookable on the pre-cached side of the code=20 (meaning it doesn't get called every imenu, just on *rescan*). It puts=20 the function names in a hash, and if they are dupes, it puts (n) after=20 the name. Works great. Chris ------ Original Message ------ From: "Chris Hecker" <checker@HIDDEN> To: "Alan Mackenzie" <acm@HIDDEN>; "Philip Kaludercic"=20 <philipk@HIDDEN> Cc: 57996 <at> debbugs.gnu.org Sent: 2022-10-05 04:15:12 Subject: Re[3]: bug#57996: 28.2; imenu doesn't differentiate overloaded=20 c++ functions > >Hmm... > >item is selected by the user. This function is called with >arguments consisting of the item name, the buffer position, and >the ARGUMENTS. > >This looks like it might work... I just opened my .emacs and found I'd=20 >already hacked my own version of the c++ matching function, so maybe=20 >I'll try this. > >A few minutes later... > >Okay, so this function does indeed get called, but both Function=20 >elements in the imenu list pass the marker for the first Function, so=20 >that's unfortunate... I will look at that... > >Another few minutes... > >Well, it looks like imenu--generic-function generates the right alist=20 >with the two functions and the two different markers, so it's something=20 >about choosing in the buffer... > >Here's the alist return, looks good: > >(("Function" . #<marker at 2 in c.cpp>) > ("Function" . #<marker at 41 in c.cpp>) > ("Bar" . #<marker at 95 in c.cpp>)) > >I should sleep, but maybe there's just a bug in the code that selects=20 >the function, or it searches by name instead of by index. I wish=20 >there was some way for the regex match to return a mangled name...I'll=20 >look into imenu next. > >Chris > >------ Original Message ------ >From: "Chris Hecker" <checker@HIDDEN> >To: "Alan Mackenzie" <acm@HIDDEN>; "Philip Kaludercic"=20 ><philipk@HIDDEN> >Cc: 57996 <at> debbugs.gnu.org >Sent: 2022-10-05 03:47:06 >Subject: Re[2]: bug#57996: 28.2; imenu doesn't differentiate overloaded=20 >c++ functions > >> >>Yeah, I should probably switch to something a little more modern, but=20 >>imenu has the advantage of just being there and working most of the=20 >>time across all machines and shells and stuff. It definitely gets=20 >>confused occasionally (like it doesn't find inline functions in class=20 >>declarations) but this overload thing seemed like it might be a simple=20 >>fix. >> >> >>The scanning interface to imenu allows just function names to be >>collected. It doesn't allow anything extra (such as a line number) to >>be included into the alist. >> >>I guess you could mangle the name to include the line number or match=20 >>number...kinda hacky but it'd work...maybe I'll take a look. >> >>Chris >> >> >>------ Original Message ------ >>From: "Alan Mackenzie" <acm@HIDDEN> >>To: "Philip Kaludercic" <philipk@HIDDEN> >>Cc: "Chris Hecker" <checker@HIDDEN>; 57996 <at> debbugs.gnu.org >>Sent: 2022-10-05 03:31:11 >>Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded=20 >>c++ functions >> >>>Hello, Chris and Philip. >>> >>>On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Kaludercic wrote: >>>> "Chris Hecker" <checker@HIDDEN> writes: >>> >>>> > With this dumb c++ file: >>>> > ---- >>>> > int Function( int n ) { >>>> > return n; >>>> > } >>>> > int Function( float v ) { >>>> > return (int)(v + 0.5); >>>> > } >>>> > ---- >>> >>>> > Hitting imenu only gives a single Function entry. It should probab= ly >>>> > give two, maybe with a line number after them like "Function(123)"= or >>>> > whatever. Currently there's no way to get to the second Function f= rom >>>> > imenu. >>> >>>imenu is old and rather simplistic. It parses a buffer, then stores the >>>results in an association list. It then uses the function assoc on that >>>list to get "the" match. What we could do with is a function which gets >>>_all_ the matches from an alist, and I've asked on emacs-devel about >>>this. >>> >>>> Note that this is not the case when using Eglot and a LSP server like >>>> clangd. >>> >>>Much more modern! >>> >>>> I've CC'ed Alan to see if he knows how this could be done by c++-mode >>>> itself. >>> >>>I'm pretty sure it couldn't be. I think it would involve enhancing >>>imenu. The scanning interface to imenu allows just function names to be >>>collected. It doesn't allow anything extra (such as a line number) to >>>be included into the alist. >>> >>>I've looked at problems with imenu in C++ Mode before, but got bogged >>>down without coming up with a workable solution. There the problem was >>>identically named methods in different classes, or something like that. >>> >>>So, maybe we can enhance imenu. But not for Emacs 29. >>> >>>-- >>>Alan Mackenzie (Nuremberg, Germany). --------=_MB82838367-B5F7-4DA9-BD2E-734761B5C01C Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head><style id=3D"css_styles">blockquote.cite { margin-left: 5px; ma= rgin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px so= lid #cccccc } blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px;= padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding= -top: 0px; } a img { border: 0px; } li[style=3D'text-align: center;'], li[style=3D'text-align: center; '], li[s= tyle=3D'text-align: right;'], li[style=3D'text-align: right; '] { list-sty= le-position: inside;} body { font-family: Segoe UI; font-size: 12pt; }=20 .quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb soli= d; padding-left: 0.3em; }</style></head><body><div><br /></div><div>Okay, I = figured out a way to do this that works pretty easily, and the same idea c= ould be integrated into imenu fairly trivially:</div><div><br /></div><bloc= kquote style=3D"margin: 0 0 0 40px; border: none; padding: 0px;"><div>(defu= n checker-imenu-make-unique-alist (index-alist) </div><div>=C2=A0 "De-duplicate the imenu alist by adding indices to duplic= ate names." </div><div>=C2=A0 (let ((h (make-hash-table :test #'equal))) </div><div>=C2=A0 =C2=A0 (mapc (lambda (el) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let* ((k (car el)) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(v (gethash k h))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if v </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= let ((n (car v))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (if (=3D n 1) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (setcar (car (cdr v)) (format "%s(1)" k))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (setq n (1+ n)) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (puthash k '(n nil) h) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (setcar el (format "%s(%d)" k n))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (puthash = k (list 1 el) h)))) </div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 index-alist))) </div><div>(advice-add 'imenu--truncate-items :filter-return #'checker-imen= u-make-unique-alist) </div></blockquote><div><br /></div><div>So this just hooks the imenu--trun= cate-items function because it was the easiest function that was hookable o= n the pre-cached side of the code (meaning it doesn't get called every imen= u, just on *rescan*).=C2=A0 It puts the function names in a hash, and if th= ey are dupes, it puts (n) after the name.=C2=A0 Works great.</div><div><br= /></div><div>Chris</div><div><br /></div><div><br /></div> <div><br /></div> <div>------ Original Message ------</div> <div>From: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@d6.= com</a>></div> <div>To: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a>&= gt;; "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">philipk@= posteo.net</a>></div> <div>Cc: <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</a>= </div> <div>Sent: 2022-10-05 04:15:12</div> <div>Subject: Re[3]: bug#57996: 28.2; imenu doesn't differentiate overloade= d c++ functions</div><div><br /></div> <div id=3D"xfeaa62b925fd48c"><blockquote type=3D"cite" class=3D"cite2"> <div><br /></div><div>Hmm...</div><div></div> <div><br /><div><div id=3D"xa7b59288d32a4b05a06a858fcd513fd3"><div>item is= selected by the user.=C2=A0 This function is called with </div><div>arguments consisting of the item name, the buffer position, and </div><div>the ARGUMENTS.</div></div></div><div><br /></div><div>This looks = like it might work...=C2=A0 I just opened my .emacs and found I'd already= hacked my own version of the c++ matching function, so maybe I'll try this.= </div><div><br /></div><div>A few minutes later...</div><div><br /></div><d= iv>Okay, so this function does indeed get called, but both Function element= s in the imenu list pass the marker for the first Function, so that's unfor= tunate...=C2=A0 I will look at that...</div><div><br /></div><div>Another f= ew minutes...</div><div><br /></div><div>Well, it looks like imenu--generic= -function generates the right alist with the two functions and the two diff= erent markers, so it's something about choosing in the buffer...</div><div>= <br /></div><div>Here's the alist return, looks good:</div><div></div><div>= <br /><div><div id=3D"xa1297727881c4d348172e3b8263e7e6a"><div>(("Function"= . #<marker at 2 in c.cpp>) </div><div>=C2=A0("Function" . #<marker at 41 in c.cpp>) </div><div>=C2=A0("Bar" . #<marker at 95 in c.cpp>)) </div><div></div></div></div></div><div><br /></div><div>I should sleep, bu= t maybe there's just a bug in the code that selects the function, or it sea= rches by name instead of by index.=C2=A0 =C2=A0I wish there was some way fo= r the regex match to return a mangled name...I'll look into imenu next.</di= v><div><br /></div><div>Chris</div><div><br /></div><div><div id=3D"xa7b592= 88d32a4b05a06a858fcd513fd3"><div> </div><div></div></div></div></div> <div>------ Original Message ------</div> <div>From: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@d6.= com</a>></div> <div>To: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a>&= gt;; "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">philipk@= posteo.net</a>></div> <div>Cc: <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</a>= </div> <div>Sent: 2022-10-05 03:47:06</div> <div>Subject: Re[2]: bug#57996: 28.2; imenu doesn't differentiate overloade= d c++ functions</div><div><br /></div> <div id=3D"xb10dd9c9c00a421"><blockquote type=3D"cite" class=3D"cite2"> <div><br /></div><div>Yeah, I should probably switch to something a little= more modern, but imenu has the advantage of just being there and working mo= st of the time across all machines and shells and stuff.=C2=A0 It definitel= y gets confused occasionally (like it doesn't find inline functions in clas= s declarations) but this overload thing seemed like it might be a simple fi= x.</div><div><br /></div><div><br /><div><div id=3D"x76222cf8bd0c4b028ef0b4= 0bc9c5c682"><div class=3D"plain_line">The scanning interface to imenu allow= s just function names to be</div> <div class=3D"plain_line">collected. It doesn't allow anything extra (such = as a line number) to</div> <div class=3D"plain_line">be included into the alist.</div></div></div><div= ><br /></div></div><div>I guess you could mangle the name to include the li= ne number or match number...kinda hacky but it'd work...maybe I'll take a l= ook.</div><div><br /></div><div>Chris</div><div><br /></div> <div><br /></div> <div>------ Original Message ------</div> <div>From: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a= >></div> <div>To: "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">phil= ipk@HIDDEN</a>></div> <div>Cc: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@HIDDEN= m</a>>; <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</= a></div> <div>Sent: 2022-10-05 03:31:11</div> <div>Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded c= ++ functions</div><div><br /></div> <div id=3D"x11f6bb6266934aa"><blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line">Hello, Chris and Philip.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Ka= ludercic wrote:</div> <blockquote type=3D"cite" class=3D"cite"> <div class=3D"plain_line"> "Chris Hecker" <<a href=3D"mailto:checker@d6.= com">checker@HIDDEN</a>> writes:</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> > With this dumb c++ file:</div> <div class=3D"plain_line"> > ----</div> <div class=3D"plain_line"> > int Function( int n ) {</div> <div class=3D"plain_line"> > return n;</div> <div class=3D"plain_line"> > }</div> <div class=3D"plain_line"> > int Function( float v ) {</div> <div class=3D"plain_line"> > return (int)(v + 0.5);</div> <div class=3D"plain_line"> > }</div> <div class=3D"plain_line"> > ----</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> > Hitting imenu only gives a single Function= entry. It should probably</div> <div class=3D"plain_line"> > give two, maybe with a line number after th= em like "Function(123)" or</div> <div class=3D"plain_line"> > whatever. Currently there's no way to get= to the second Function from</div> <div class=3D"plain_line"> > imenu.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">imenu is old and rather simplistic. It parses a= buffer, then stores the</div> <div class=3D"plain_line">results in an association list. It then uses the = function assoc on that</div> <div class=3D"plain_line">list to get "the" match. What we could do with i= s a function which gets</div> <div class=3D"plain_line">_all_ the matches from an alist, and I've asked o= n emacs-devel about</div> <div class=3D"plain_line">this.</div> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> Note that this is not the case when using Eglot= and a LSP server like</div> <div class=3D"plain_line"> clangd.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">Much more modern!</div> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> I've CC'ed Alan to see if he knows how this coul= d be done by c++-mode</div> <div class=3D"plain_line"> itself.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">I'm pretty sure it couldn't be. I think it would = involve enhancing</div> <div class=3D"plain_line">imenu. The scanning interface to imenu allows ju= st function names to be</div> <div class=3D"plain_line">collected. It doesn't allow anything extra (such = as a line number) to</div> <div class=3D"plain_line">be included into the alist.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">I've looked at problems with imenu in C++ Mode be= fore, but got bogged</div> <div class=3D"plain_line">down without coming up with a workable solution. = There the problem was</div> <div class=3D"plain_line">identically named methods in different classes, o= r something like that.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">So, maybe we can enhance imenu. But not for Emac= s 29.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">--</div> <div class=3D"plain_line">Alan Mackenzie (Nuremberg, Germany).</div> </blockquote></div> </blockquote></div> </blockquote></div> </body></html> --------=_MB82838367-B5F7-4DA9-BD2E-734761B5C01C--
bug-gnu-emacs@HIDDEN
:bug#57996
; Package emacs
.
Full text available.Received: (at 57996) by debbugs.gnu.org; 5 Oct 2022 11:15:23 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 05 07:15:22 2022 Received: from localhost ([127.0.0.1]:56073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1og2N0-0006pm-55 for submit <at> debbugs.gnu.org; Wed, 05 Oct 2022 07:15:22 -0400 Received: from mail-pl1-f181.google.com ([209.85.214.181]:40802) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <checker@HIDDEN>) id 1og2Mx-0006pU-8w for 57996 <at> debbugs.gnu.org; Wed, 05 Oct 2022 07:15:20 -0400 Received: by mail-pl1-f181.google.com with SMTP id b2so10228297plc.7 for <57996 <at> debbugs.gnu.org>; Wed, 05 Oct 2022 04:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=d6-com.20210112.gappssmtp.com; s=20210112; h=mime-version:user-agent:reply-to:references:in-reply-to:message-id :date:cc:subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=PZSvoddJCL1yyom2KzMf3NkvIUf0Eug3JUHIpyCQohs=; b=ahQMBpC2U0FJ89kvI6ZMurRf6yg/ga5SQ1vyRltP7LddEU/9qtdrU8Qn75cj/FsReK qn2Ug4T7WXcDDLhBPzD+gqbyPf4pNzzyNn3NtmkyhxrJhjJ8FaXKD5FpBnTHOnoD1lg9 zgyeye6efKLub3A3glbspwAsuERoQO97edYuklpS7yz5+MWO8QIohas7KKPI9qMB1lhT KAr6JqauMDYUEEiZGaGI5H9YaVVUDKLBAJG/1uo+zVDqgtot+5tIH1SXprieCLtPgLTx nPKOiXLCJ1+j3hFAMehS3XNnzibGtfbDg2N1h4Y2V+r1ugsveIcFP6dxteysYsvsV/4X vuxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:reply-to:references:in-reply-to:message-id :date:cc:subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PZSvoddJCL1yyom2KzMf3NkvIUf0Eug3JUHIpyCQohs=; b=ToNlDp+P/PgLZY/A81S0dr1xUt9u8x2jkJPjUABBLPg0nR7PciofjEhFSHbON+xHRm D1Y2Grj+13wggr8lnyF03RQKqrpXGvt0AVp05DXXQP+S5SoRKlaxBH4eXJhv4TF5eiYH D+aIvAFWwHxCKUSb69FwMeu37vd8DuJQy4Gq+/1NsH/ptvXLvCQSOlpJM20cJqPjaTUR /TjAA5Tc0PTQX75eKqJRfi1S/kFg+upx/NRk28bQpd5rQS1IFF0mdp4b+W/N6qn3LhmJ 35wT1fG/caSTsRXnYhG+wUd77T8pcVQFtEkDd6xKWeHT/RPg3J9nkt/O2acrmOlXWUBQ 25mQ== X-Gm-Message-State: ACrzQf2xYMTkT9fHTpmHK4TZkQY7g7B0qrsRx98WTjU/WGsMEA9eLgqY DgXLVgVxxafWhg0p5oYs6RucKA== X-Google-Smtp-Source: AMsMyM4OoXO/QAy3y18munvvZGUfUWnatlfrYM7d5PiQ3ySO/tdjBdTPZadDynPzZN7KrKYIY6ikVg== X-Received: by 2002:a17:902:aa89:b0:178:a537:f386 with SMTP id d9-20020a170902aa8900b00178a537f386mr31751811plr.124.1664968513310; Wed, 05 Oct 2022 04:15:13 -0700 (PDT) Received: from [192.168.1.217] (157-131-207-86.fiber.dynamic.sonic.net. [157.131.207.86]) by smtp.gmail.com with ESMTPSA id l11-20020a17090a384b00b0020a8f44e52csm948697pjf.38.2022.10.05.04.15.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Oct 2022 04:15:12 -0700 (PDT) From: "Chris Hecker" <checker@HIDDEN> To: "Alan Mackenzie" <acm@HIDDEN>, "Philip Kaludercic" <philipk@HIDDEN> Subject: Re[3]: bug#57996: 28.2; imenu doesn't differentiate overloaded c++ functions Date: Wed, 05 Oct 2022 11:15:12 +0000 Message-Id: <em35cdca27-cc1a-4e4c-8971-4df43aab68b1@checker-blade15> In-Reply-To: <emd474b896-1b01-4a2a-8d44-d43f17d7634c@checker-blade15> References: <em9dbf9c23-ed96-4c46-88c5-cdd300b87fee@checker-blade15> <87v8p22wsz.fsf@HIDDEN> <Yz1c721Ohisf5909@acm> <emd474b896-1b01-4a2a-8d44-d43f17d7634c@checker-blade15> User-Agent: eM_Client/8.2.1721.0 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------=_MB2BB425C4-7CDE-41E2-AD7E-1EBC946A8BB9" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 57996 Cc: 57996 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: Chris Hecker <checker@HIDDEN> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --------=_MB2BB425C4-7CDE-41E2-AD7E-1EBC946A8BB9 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Hmm... item is selected by the user. This function is called with arguments consisting of the item name, the buffer position, and the ARGUMENTS. This looks like it might work... I just opened my .emacs and found I'd=20 already hacked my own version of the c++ matching function, so maybe=20 I'll try this. A few minutes later... Okay, so this function does indeed get called, but both Function=20 elements in the imenu list pass the marker for the first Function, so=20 that's unfortunate... I will look at that... Another few minutes... Well, it looks like imenu--generic-function generates the right alist=20 with the two functions and the two different markers, so it's something=20 about choosing in the buffer... Here's the alist return, looks good: (("Function" . #<marker at 2 in c.cpp>) ("Function" . #<marker at 41 in c.cpp>) ("Bar" . #<marker at 95 in c.cpp>)) I should sleep, but maybe there's just a bug in the code that selects=20 the function, or it searches by name instead of by index. I wish there=20 was some way for the regex match to return a mangled name...I'll look=20 into imenu next. Chris ------ Original Message ------ From: "Chris Hecker" <checker@HIDDEN> To: "Alan Mackenzie" <acm@HIDDEN>; "Philip Kaludercic"=20 <philipk@HIDDEN> Cc: 57996 <at> debbugs.gnu.org Sent: 2022-10-05 03:47:06 Subject: Re[2]: bug#57996: 28.2; imenu doesn't differentiate overloaded=20 c++ functions > >Yeah, I should probably switch to something a little more modern, but=20 >imenu has the advantage of just being there and working most of the=20 >time across all machines and shells and stuff. It definitely gets=20 >confused occasionally (like it doesn't find inline functions in class=20 >declarations) but this overload thing seemed like it might be a simple=20 >fix. > > >The scanning interface to imenu allows just function names to be >collected. It doesn't allow anything extra (such as a line number) to >be included into the alist. > >I guess you could mangle the name to include the line number or match=20 >number...kinda hacky but it'd work...maybe I'll take a look. > >Chris > > >------ Original Message ------ >From: "Alan Mackenzie" <acm@HIDDEN> >To: "Philip Kaludercic" <philipk@HIDDEN> >Cc: "Chris Hecker" <checker@HIDDEN>; 57996 <at> debbugs.gnu.org >Sent: 2022-10-05 03:31:11 >Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded=20 >c++ functions > >>Hello, Chris and Philip. >> >>On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Kaludercic wrote: >>> "Chris Hecker" <checker@HIDDEN> writes: >> >>> > With this dumb c++ file: >>> > ---- >>> > int Function( int n ) { >>> > return n; >>> > } >>> > int Function( float v ) { >>> > return (int)(v + 0.5); >>> > } >>> > ---- >> >>> > Hitting imenu only gives a single Function entry. It should probabl= y >>> > give two, maybe with a line number after them like "Function(123)" o= r >>> > whatever. Currently there's no way to get to the second Function fr= om >>> > imenu. >> >>imenu is old and rather simplistic. It parses a buffer, then stores the >>results in an association list. It then uses the function assoc on that >>list to get "the" match. What we could do with is a function which gets >>_all_ the matches from an alist, and I've asked on emacs-devel about >>this. >> >>> Note that this is not the case when using Eglot and a LSP server like >>> clangd. >> >>Much more modern! >> >>> I've CC'ed Alan to see if he knows how this could be done by c++-mode >>> itself. >> >>I'm pretty sure it couldn't be. I think it would involve enhancing >>imenu. The scanning interface to imenu allows just function names to be >>collected. It doesn't allow anything extra (such as a line number) to >>be included into the alist. >> >>I've looked at problems with imenu in C++ Mode before, but got bogged >>down without coming up with a workable solution. There the problem was >>identically named methods in different classes, or something like that. >> >>So, maybe we can enhance imenu. But not for Emacs 29. >> >>-- >>Alan Mackenzie (Nuremberg, Germany). --------=_MB2BB425C4-7CDE-41E2-AD7E-1EBC946A8BB9 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head><style id=3D"pgp_css" type=3D"text/css"><!----></style><style t= ype=3D"text/css"><!--#xb10dd9c9c00a421 blockquote.cite {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right: 0p= x; border-left: 1px solid rgb(204, 204, 204);} #xb10dd9c9c00a421 blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right: 0p= x; border-left: 1px solid rgb(204, 204, 204); margin-top: 3px; padding-top: = 0px;} #xb10dd9c9c00a421 {font-family: "Segoe UI"; font-size: 12pt;} #xb10dd9c9c00a421 .quote {margin-left: 1em; margin-right: 1em; border-left: 5px solid rgb(235, 235,= 235); padding-left: 0.3em;} --></style><style id=3D"css_styles" type=3D"text/css"><!--blockquote.cite { = margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px= ; border-left: 1px solid #cccccc } blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px;= padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding= -top: 0px; } a img { border: 0px; } li[style=3D'text-align: center;'], li[style=3D'text-align: center; '], li[s= tyle=3D'text-align: right;'], li[style=3D'text-align: right; '] { list-sty= le-position: inside;} body { font-family: Segoe UI; font-size: 12pt; }=20 .quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb soli= d; padding-left: 0.3em; }--></style> </head><body><div><br /></div><div>Hmm...</div><div></div> <div><br /><div class=3D"quote"><div id=3D"xa7b59288d32a4b05a06a858fcd513fd= 3"><div>item is selected by the user.=C2=A0 This function is called with </div><div>arguments consisting of the item name, the buffer position, and </div><div>the ARGUMENTS.</div></div></div><div><br /></div><div>This looks = like it might work...=C2=A0 I just opened my .emacs and found I'd already= hacked my own version of the c++ matching function, so maybe I'll try this.= </div><div><br /></div><div><i>A few minutes later...</i></div><div><br /><= /div><div>Okay, so this function does indeed get called, but both Function= elements in the imenu list pass the marker for the first Function, so that'= s unfortunate...=C2=A0 I will look at that...</div><div><br /></div><div><i= >Another few minutes...</i></div><div><br /></div><div>Well, it looks like= imenu--generic-function generates the right alist with the two functions an= d the two different markers, so it's something about choosing in the buffer= ...</div><div><br /></div><div>Here's the alist return, looks good:</div><d= iv></div><div><br /><div class=3D"quote"><div id=3D"xa1297727881c4d348172e3= b8263e7e6a"><div style=3D"background-color:rgba(0,0,0,0);">(("Function" . #= <marker at 2 in c.cpp>) </div><div style=3D"background-color:rgba(0,0,0,0);">=C2=A0("Function" . #&= lt;marker at 41 in c.cpp>) </div><div style=3D"background-color:rgba(0,0,0,0);">=C2=A0("Bar" . #<ma= rker at 95 in c.cpp>)) </div><div style=3D"background-color:rgba(0,0,0,0);"></div></div></div></di= v><div><br /></div><div>I should sleep, but maybe there's just a bug in the = code that selects the function, or it searches by name instead of by index= .=C2=A0 =C2=A0I wish there was some way for the regex match to return a man= gled name...I'll look into imenu next.</div><div><br /></div><div>Chris</di= v><div><br /></div><div class=3D"quote"><div id=3D"xa7b59288d32a4b05a06a858= fcd513fd3"><div> </div><div></div></div></div></div> <div>------ Original Message ------</div> <div>From: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@d6.= com</a>></div> <div>To: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a>&= gt;; "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">philipk@= posteo.net</a>></div> <div>Cc: <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</a>= </div> <div>Sent: 2022-10-05 03:47:06</div> <div>Subject: Re[2]: bug#57996: 28.2; imenu doesn't differentiate overloade= d c++ functions</div><div><br /></div> <div id=3D"xb10dd9c9c00a421" class=3D"plain"><blockquote cite=3D"emd474b896= -1b01-4a2a-8d44-d43f17d7634c@checker-blade15" type=3D"cite" class=3D"cite2"= > <div><br /></div><div>Yeah, I should probably switch to something a little= more modern, but imenu has the advantage of just being there and working mo= st of the time across all machines and shells and stuff.=C2=A0 It definitel= y gets confused occasionally (like it doesn't find inline functions in clas= s declarations) but this overload thing seemed like it might be a simple fi= x.</div><div><br /></div><div><br /><div class=3D"quote"><div id=3D"x76222c= f8bd0c4b028ef0b40bc9c5c682"><div class=3D"plain_line" style=3D"background-c= olor:rgba(0,0,0,0);">The scanning interface to imenu allows just function n= ames to be</div> <div class=3D"plain_line" style=3D"background-color:rgba(0,0,0,0);">collect= ed. It doesn't allow anything extra (such as a line number) to</div> <div class=3D"plain_line" style=3D"background-color:rgba(0,0,0,0);">be incl= uded into the alist.</div></div></div><div><br /></div></div><div>I guess y= ou could mangle the name to include the line number or match number...kinda = hacky but it'd work...maybe I'll take a look.</div><div><br /></div><div>C= hris</div><div><br /></div> <div><br /></div> <div>------ Original Message ------</div> <div>From: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a= >></div> <div>To: "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">phil= ipk@HIDDEN</a>></div> <div>Cc: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@HIDDEN= m</a>>; <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</= a></div> <div>Sent: 2022-10-05 03:31:11</div> <div>Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded c= ++ functions</div><div><br /></div> <div id=3D"x11f6bb6266934aa"><blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line">Hello, Chris and Philip.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Ka= ludercic wrote:</div> <blockquote type=3D"cite" class=3D"cite"> <div class=3D"plain_line"> "Chris Hecker" <<a href=3D"mailto:checker@d6.= com">checker@HIDDEN</a>> writes:</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> > With this dumb c++ file:</div> <div class=3D"plain_line"> > ----</div> <div class=3D"plain_line"> > int Function( int n ) {</div> <div class=3D"plain_line"> > return n;</div> <div class=3D"plain_line"> > }</div> <div class=3D"plain_line"> > int Function( float v ) {</div> <div class=3D"plain_line"> > return (int)(v + 0.5);</div> <div class=3D"plain_line"> > }</div> <div class=3D"plain_line"> > ----</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> > Hitting imenu only gives a single Function= entry. It should probably</div> <div class=3D"plain_line"> > give two, maybe with a line number after th= em like "Function(123)" or</div> <div class=3D"plain_line"> > whatever. Currently there's no way to get= to the second Function from</div> <div class=3D"plain_line"> > imenu.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">imenu is old and rather simplistic. It parses a= buffer, then stores the</div> <div class=3D"plain_line">results in an association list. It then uses the = function assoc on that</div> <div class=3D"plain_line">list to get "the" match. What we could do with i= s a function which gets</div> <div class=3D"plain_line">_all_ the matches from an alist, and I've asked o= n emacs-devel about</div> <div class=3D"plain_line">this.</div> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> Note that this is not the case when using Eglot= and a LSP server like</div> <div class=3D"plain_line"> clangd.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">Much more modern!</div> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> I've CC'ed Alan to see if he knows how this coul= d be done by c++-mode</div> <div class=3D"plain_line"> itself.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">I'm pretty sure it couldn't be. I think it would = involve enhancing</div> <div class=3D"plain_line">imenu. The scanning interface to imenu allows ju= st function names to be</div> <div class=3D"plain_line">collected. It doesn't allow anything extra (such = as a line number) to</div> <div class=3D"plain_line">be included into the alist.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">I've looked at problems with imenu in C++ Mode be= fore, but got bogged</div> <div class=3D"plain_line">down without coming up with a workable solution. = There the problem was</div> <div class=3D"plain_line">identically named methods in different classes, o= r something like that.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">So, maybe we can enhance imenu. But not for Emac= s 29.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">--</div> <div class=3D"plain_line">Alan Mackenzie (Nuremberg, Germany).</div> </blockquote></div> </blockquote></div> </body></html> --------=_MB2BB425C4-7CDE-41E2-AD7E-1EBC946A8BB9--
bug-gnu-emacs@HIDDEN
:bug#57996
; Package emacs
.
Full text available.Received: (at 57996) by debbugs.gnu.org; 5 Oct 2022 10:47:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 05 06:47:17 2022 Received: from localhost ([127.0.0.1]:56017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1og1vo-0005vv-FH for submit <at> debbugs.gnu.org; Wed, 05 Oct 2022 06:47:17 -0400 Received: from mail-pl1-f170.google.com ([209.85.214.170]:43909) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <checker@HIDDEN>) id 1og1vl-0005vc-8d for 57996 <at> debbugs.gnu.org; Wed, 05 Oct 2022 06:47:15 -0400 Received: by mail-pl1-f170.google.com with SMTP id z20so8539029plb.10 for <57996 <at> debbugs.gnu.org>; Wed, 05 Oct 2022 03:47:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=d6-com.20210112.gappssmtp.com; s=20210112; h=mime-version:user-agent:reply-to:references:in-reply-to:message-id :date:cc:subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=QfxrXd2Gfx6/QKak9Q9EHqGFKR61UJRpwnNJeUErNnk=; b=oMyiCQTwRCAil4OYpIoOEkRTsTWfowihqq0vWBJw+GkI1cdakKrSPMVPOvYFGxt4+A QK9xJn/PwiELpahIeLVfH5Spu+cCDj3TGBtNXULHVL1b+mRz6kyoHoNlFpo2QUp2wttK 4D8uEmpW7Ws2Ft/3roHe3GSLA6CHpFOwPmdZ63meYnOJkcpB5DmRVH4ZjrhYLoYFfcN+ RiWmX2dIMvaaElHrRDd91XrO3M+FgGiCXPxIObNwu2i5s22fYWWmB7plIrevAnN3SElY 9+tYWygnOVJVM6VW3ujBzKr5c2lPLImLGhOXcDTsGMh5TbhWMXs9rBEcSyECYTysgFa+ HpVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:reply-to:references:in-reply-to:message-id :date:cc:subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QfxrXd2Gfx6/QKak9Q9EHqGFKR61UJRpwnNJeUErNnk=; b=Xpmgm9Rp2jkDl694D8YafdZ7Ylkk2hhwbRX/Vq0EkQHfqWTvi5hGqxmllv139cgsfx AQ5Xf+m4OjBIHudnPrDDX/6jqi44sj3jmzc61jbkMlg0Kv9Jr5yxqYqivN9/kn0gd5+f kifBYx+OK8QtBHCvlyO24GObNoA+RNtof1jdIhCqHoRoGKTknbj8vexQDJnFiFja4T9h 5Otafi4570ihqlYYoSe7HT7z21LzsKHSTQHmlnjX7fHXfX0pyb1BdR/OrdKbUOWtPLFG 8pBTS5jT23mmW3ymxDfXrVLdSx2EwaUbnOzIqLGlxbQjqsUR3tCeyhE30tRMgvWmdwsI TDtQ== X-Gm-Message-State: ACrzQf20oRKZp0Zq0PzFhABf+ks0MpZF3is5i0P8aAHFCwq66dywoZGc XKOg0j8f4Ofdp5bX7JZAy1GXYA== X-Google-Smtp-Source: AMsMyM6QErsFQdA1eX8zdtiQMsCCqSfwvo6uUC9YEIdKDPS4KelCsQ8yqGQ7AXsNR/5gLlMvPw3HtQ== X-Received: by 2002:a17:902:db08:b0:176:d40e:4b57 with SMTP id m8-20020a170902db0800b00176d40e4b57mr31536721plx.172.1664966827361; Wed, 05 Oct 2022 03:47:07 -0700 (PDT) Received: from [192.168.1.217] (157-131-207-86.fiber.dynamic.sonic.net. [157.131.207.86]) by smtp.gmail.com with ESMTPSA id u5-20020a170902e80500b00177faf558b5sm10042672plg.250.2022.10.05.03.47.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Oct 2022 03:47:07 -0700 (PDT) From: "Chris Hecker" <checker@HIDDEN> To: "Alan Mackenzie" <acm@HIDDEN>, "Philip Kaludercic" <philipk@HIDDEN> Subject: Re[2]: bug#57996: 28.2; imenu doesn't differentiate overloaded c++ functions Date: Wed, 05 Oct 2022 10:47:06 +0000 Message-Id: <emd474b896-1b01-4a2a-8d44-d43f17d7634c@checker-blade15> In-Reply-To: <Yz1c721Ohisf5909@acm> References: <em9dbf9c23-ed96-4c46-88c5-cdd300b87fee@checker-blade15> <87v8p22wsz.fsf@HIDDEN> <Yz1c721Ohisf5909@acm> User-Agent: eM_Client/8.2.1721.0 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------=_MB81CF0EDA-EDB4-47CD-AF48-6B1499652518" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 57996 Cc: 57996 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: Chris Hecker <checker@HIDDEN> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --------=_MB81CF0EDA-EDB4-47CD-AF48-6B1499652518 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Yeah, I should probably switch to something a little more modern, but=20 imenu has the advantage of just being there and working most of the time=20 across all machines and shells and stuff. It definitely gets confused=20 occasionally (like it doesn't find inline functions in class=20 declarations) but this overload thing seemed like it might be a simple=20 fix. The scanning interface to imenu allows just function names to be collected. It doesn't allow anything extra (such as a line number) to be included into the alist. I guess you could mangle the name to include the line number or match=20 number...kinda hacky but it'd work...maybe I'll take a look. Chris ------ Original Message ------ From: "Alan Mackenzie" <acm@HIDDEN> To: "Philip Kaludercic" <philipk@HIDDEN> Cc: "Chris Hecker" <checker@HIDDEN>; 57996 <at> debbugs.gnu.org Sent: 2022-10-05 03:31:11 Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded c++=20 functions >Hello, Chris and Philip. > >On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Kaludercic wrote: >> "Chris Hecker" <checker@HIDDEN> writes: > >> > With this dumb c++ file: >> > ---- >> > int Function( int n ) { >> > return n; >> > } >> > int Function( float v ) { >> > return (int)(v + 0.5); >> > } >> > ---- > >> > Hitting imenu only gives a single Function entry. It should probably >> > give two, maybe with a line number after them like "Function(123)" or >> > whatever. Currently there's no way to get to the second Function fro= m >> > imenu. > >imenu is old and rather simplistic. It parses a buffer, then stores the >results in an association list. It then uses the function assoc on that >list to get "the" match. What we could do with is a function which gets >_all_ the matches from an alist, and I've asked on emacs-devel about >this. > >> Note that this is not the case when using Eglot and a LSP server like >> clangd. > >Much more modern! > >> I've CC'ed Alan to see if he knows how this could be done by c++-mode >> itself. > >I'm pretty sure it couldn't be. I think it would involve enhancing >imenu. The scanning interface to imenu allows just function names to be >collected. It doesn't allow anything extra (such as a line number) to >be included into the alist. > >I've looked at problems with imenu in C++ Mode before, but got bogged >down without coming up with a workable solution. There the problem was >identically named methods in different classes, or something like that. > >So, maybe we can enhance imenu. But not for Emacs 29. > >-- >Alan Mackenzie (Nuremberg, Germany). --------=_MB81CF0EDA-EDB4-47CD-AF48-6B1499652518 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head><style id=3D"">#x76222cf8bd0c4b028ef0b40bc9c5c682 blockquote.ci= te{ border-left:1px solid #CCC; }</style> <style id=3D"css_styles" type=3D"text/css"><!--blockquote.cite { margin-lef= t: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-le= ft: 1px solid #cccccc } blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px;= padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding= -top: 0px; } a img { border: 0px; } li[style=3D'text-align: center;'], li[style=3D'text-align: center; '], li[s= tyle=3D'text-align: right;'], li[style=3D'text-align: right; '] { list-sty= le-position: inside;} body { font-family: Segoe UI; font-size: 12pt; }=20 .quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb soli= d; padding-left: 0.3em; }--></style></head><body class=3D"plain"><div><br /= ></div><div>Yeah, I should probably switch to something a little more moder= n, but imenu has the advantage of just being there and working most of the= time across all machines and shells and stuff.=C2=A0 It definitely gets con= fused occasionally (like it doesn't find inline functions in class declarat= ions) but this overload thing seemed like it might be a simple fix.</div><d= iv><br /></div><div><br /><div class=3D"quote"><div id=3D"x76222cf8bd0c4b02= 8ef0b40bc9c5c682"><div class=3D"plain_line" style=3D"background-color:rgba(= 0,0,0,0);">The scanning interface to imenu allows just function names to be= </div> <div class=3D"plain_line" style=3D"background-color:rgba(0,0,0,0);">collect= ed. It doesn't allow anything extra (such as a line number) to</div> <div class=3D"plain_line" style=3D"background-color:rgba(0,0,0,0);">be incl= uded into the alist.</div></div></div><div><br /></div></div><div>I guess y= ou could mangle the name to include the line number or match number...kinda = hacky but it'd work...maybe I'll take a look.</div><div><br /></div><div>C= hris</div><div><br /></div> <div><br /></div> <div>------ Original Message ------</div> <div>From: "Alan Mackenzie" <<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</a= >></div> <div>To: "Philip Kaludercic" <<a href=3D"mailto:philipk@HIDDEN">phil= ipk@HIDDEN</a>></div> <div>Cc: "Chris Hecker" <<a href=3D"mailto:checker@HIDDEN">checker@HIDDEN= m</a>>; <a href=3D"mailto:57996 <at> debbugs.gnu.org">57996 <at> debbugs.gnu.org</= a></div> <div>Sent: 2022-10-05 03:31:11</div> <div>Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded c= ++ functions</div><div><br /></div> <div id=3D"x11f6bb6266934aa"><blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line">Hello, Chris and Philip.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Ka= ludercic wrote:</div> <blockquote type=3D"cite" class=3D"cite"> <div class=3D"plain_line"> "Chris Hecker" <<a href=3D"mailto:checker@d6.= com">checker@HIDDEN</a>> writes:</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> > With this dumb c++ file:</div> <div class=3D"plain_line"> > ----</div> <div class=3D"plain_line"> > int Function( int n ) {</div> <div class=3D"plain_line"> > return n;</div> <div class=3D"plain_line"> > }</div> <div class=3D"plain_line"> > int Function( float v ) {</div> <div class=3D"plain_line"> > return (int)(v + 0.5);</div> <div class=3D"plain_line"> > }</div> <div class=3D"plain_line"> > ----</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> > Hitting imenu only gives a single Function= entry. It should probably</div> <div class=3D"plain_line"> > give two, maybe with a line number after th= em like "Function(123)" or</div> <div class=3D"plain_line"> > whatever. Currently there's no way to get= to the second Function from</div> <div class=3D"plain_line"> > imenu.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">imenu is old and rather simplistic. It parses a= buffer, then stores the</div> <div class=3D"plain_line">results in an association list. It then uses the = function assoc on that</div> <div class=3D"plain_line">list to get "the" match. What we could do with i= s a function which gets</div> <div class=3D"plain_line">_all_ the matches from an alist, and I've asked o= n emacs-devel about</div> <div class=3D"plain_line">this.</div> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> Note that this is not the case when using Eglot= and a LSP server like</div> <div class=3D"plain_line"> clangd.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">Much more modern!</div> <div class=3D"plain_line">=C2=A0</div> <blockquote type=3D"cite" class=3D"cite2"> <div class=3D"plain_line"> I've CC'ed Alan to see if he knows how this coul= d be done by c++-mode</div> <div class=3D"plain_line"> itself.</div> </blockquote> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">I'm pretty sure it couldn't be. I think it would = involve enhancing</div> <div class=3D"plain_line">imenu. The scanning interface to imenu allows ju= st function names to be</div> <div class=3D"plain_line">collected. It doesn't allow anything extra (such = as a line number) to</div> <div class=3D"plain_line">be included into the alist.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">I've looked at problems with imenu in C++ Mode be= fore, but got bogged</div> <div class=3D"plain_line">down without coming up with a workable solution. = There the problem was</div> <div class=3D"plain_line">identically named methods in different classes, o= r something like that.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">So, maybe we can enhance imenu. But not for Emac= s 29.</div> <div class=3D"plain_line">=C2=A0</div> <div class=3D"plain_line">--</div> <div class=3D"plain_line">Alan Mackenzie (Nuremberg, Germany).</div> </blockquote></div> </body></html> --------=_MB81CF0EDA-EDB4-47CD-AF48-6B1499652518--
bug-gnu-emacs@HIDDEN
:bug#57996
; Package emacs
.
Full text available.Received: (at 57996) by debbugs.gnu.org; 5 Oct 2022 10:31:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 05 06:31:23 2022 Received: from localhost ([127.0.0.1]:55990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1og1gR-0005UR-4E for submit <at> debbugs.gnu.org; Wed, 05 Oct 2022 06:31:23 -0400 Received: from mx3.muc.de ([193.149.48.5]:58186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1og1gN-0005UA-Go for 57996 <at> debbugs.gnu.org; Wed, 05 Oct 2022 06:31:22 -0400 Received: (qmail 62564 invoked by uid 3782); 5 Oct 2022 12:31:12 +0200 Received: from acm.muc.de (p4fe15bfc.dip0.t-ipconnect.de [79.225.91.252]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 05 Oct 2022 12:31:11 +0200 Received: (qmail 8989 invoked by uid 1000); 5 Oct 2022 10:31:11 -0000 Date: Wed, 5 Oct 2022 10:31:11 +0000 To: Philip Kaludercic <philipk@HIDDEN> Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded c++ functions Message-ID: <Yz1c721Ohisf5909@ACM> References: <em9dbf9c23-ed96-4c46-88c5-cdd300b87fee@checker-blade15> <87v8p22wsz.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87v8p22wsz.fsf@HIDDEN> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie <acm@HIDDEN> X-Primary-Address: acm@HIDDEN X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 57996 Cc: Chris Hecker <checker@HIDDEN>, 57996 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Chris and Philip. On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Kaludercic wrote: > "Chris Hecker" <checker@HIDDEN> writes: > > With this dumb c++ file: > > ---- > > int Function( int n ) { > > return n; > > } > > int Function( float v ) { > > return (int)(v + 0.5); > > } > > ---- > > Hitting imenu only gives a single Function entry. It should probably > > give two, maybe with a line number after them like "Function(123)" or > > whatever. Currently there's no way to get to the second Function from > > imenu. imenu is old and rather simplistic. It parses a buffer, then stores the results in an association list. It then uses the function assoc on that list to get "the" match. What we could do with is a function which gets _all_ the matches from an alist, and I've asked on emacs-devel about this. > Note that this is not the case when using Eglot and a LSP server like > clangd. Much more modern! > I've CC'ed Alan to see if he knows how this could be done by c++-mode > itself. I'm pretty sure it couldn't be. I think it would involve enhancing imenu. The scanning interface to imenu allows just function names to be collected. It doesn't allow anything extra (such as a line number) to be included into the alist. I've looked at problems with imenu in C++ Mode before, but got bogged down without coming up with a workable solution. There the problem was identically named methods in different classes, or something like that. So, maybe we can enhance imenu. But not for Emacs 29. -- Alan Mackenzie (Nuremberg, Germany).
bug-gnu-emacs@HIDDEN
:bug#57996
; Package emacs
.
Full text available.Received: (at 57996) by debbugs.gnu.org; 2 Oct 2022 13:13:30 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 02 09:13:30 2022 Received: from localhost ([127.0.0.1]:46495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1oeymg-00088F-Cv for submit <at> debbugs.gnu.org; Sun, 02 Oct 2022 09:13:30 -0400 Received: from mout02.posteo.de ([185.67.36.66]:49817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <philipk@HIDDEN>) id 1oeyme-000881-46 for 57996 <at> debbugs.gnu.org; Sun, 02 Oct 2022 09:13:29 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 9001724010A for <57996 <at> debbugs.gnu.org>; Sun, 2 Oct 2022 15:13:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1664716401; bh=N3WObZp3m0HUtE0pqXL0rdZ3jcuctdD4WVoNyR+/+qs=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=qqgM+eP3vViMkchpMQ/zmBneLm0nwP8lLJDZhgdKztyaOZKEZEpKwxMO0fOXrA6Fu BMkE9xfXtHDe2lvzqn+pkVKaVB7cZPEGdxRxRHX/OacIEvM0wMEiYg2b+pqrZizIit TRyVsW5jR87yIpeh33xV6ayif69rgey0nY2htkZ9LOPj0bzHdwxHHmlSRgRmrkr32y y0n8rhEt86hIAjQgg3mz46wL43lq5/9SDOvBngjAHkB8499OWNnKABSYl0DWx6Gpc+ f9k2p2Wy20QCl8SqNXnoiNcfCYLjsJu5vc6MEF/S+psFItUijT6SH4FY95O89lnqvm 59d1i4GLub7cg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MgPXs1h1zz9rxB; Sun, 2 Oct 2022 15:13:17 +0200 (CEST) From: Philip Kaludercic <philipk@HIDDEN> To: "Chris Hecker" <checker@HIDDEN> Subject: Re: bug#57996: 28.2; imenu doesn't differentiate overloaded c++ functions In-Reply-To: <em9dbf9c23-ed96-4c46-88c5-cdd300b87fee@checker-blade15> (Chris Hecker's message of "Thu, 22 Sep 2022 04:16:55 +0000") References: <em9dbf9c23-ed96-4c46-88c5-cdd300b87fee@checker-blade15> Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Date: Sun, 02 Oct 2022 13:13:16 +0000 Message-ID: <87v8p22wsz.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 57996 Cc: Alan Mackenzie <acm@HIDDEN>, 57996 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) "Chris Hecker" <checker@HIDDEN> writes: > With this dumb c++ file: > ---- > int Function( int n ) { > return n; > } > int Function( float v ) { > return (int)(v + 0.5); > } > ---- > > Hitting imenu only gives a single Function entry. It should probably > give two, maybe with a line number after them like "Function(123)" or > whatever. Currently there's no way to get to the second Function from > imenu. Note that this is not the case when using Eglot and a LSP server like clangd. I've CC'ed Alan to see if he knows how this could be done by c++-mode itself.
bug-gnu-emacs@HIDDEN
:bug#57996
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 22 Sep 2022 04:17:07 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 22 00:17:07 2022 Received: from localhost ([127.0.0.1]:35783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1obDe6-0001hm-Mn for submit <at> debbugs.gnu.org; Thu, 22 Sep 2022 00:17:07 -0400 Received: from lists.gnu.org ([209.51.188.17]:37292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <checker@HIDDEN>) id 1obDe4-0001hc-8b for submit <at> debbugs.gnu.org; Thu, 22 Sep 2022 00:17:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <checker@HIDDEN>) id 1obDe3-0004Rh-UB for bug-gnu-emacs@HIDDEN; Thu, 22 Sep 2022 00:17:04 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:41700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <checker@HIDDEN>) id 1obDe1-0007A0-5K for bug-gnu-emacs@HIDDEN; Thu, 22 Sep 2022 00:17:03 -0400 Received: by mail-pf1-x431.google.com with SMTP id l65so8052805pfl.8 for <bug-gnu-emacs@HIDDEN>; Wed, 21 Sep 2022 21:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=d6-com.20210112.gappssmtp.com; s=20210112; h=mime-version:user-agent:reply-to:message-id:date:subject:to:from :from:to:cc:subject:date; bh=7m2WWC7EKFD/OuIjoeoYwgrC33FclKTqd8PtL8N/Ybc=; b=VIeOVRVRSeXSOsn3ka6WZj86DGb2iQCKvh+0waeX0xCffYMCoIyZGMYQ+MOitsbBBs 4kJwrWJWeS7AcWBkAR+wKNGsBAUluANK2phO2PEEY2h3/S0Kapjav3iVHV0jpiI1k2N2 lb2hf5ow8L1tMnyD1sUSVOtA/7xCFLXfB3PuokpD1IEiJcKFkGoThpdcdCOylM0JwOVq Y0FsrEdtAuqaoizBhpzFGeDr2+IXoRoP+drsxKILr3e1qzNyP0Mgcu7mHoon5XY9NFZR iizsI0yDkHQmG69vR2/SpVFVKYV+OHxbagM6B5BZkBCkOxVDx1DRt8sGzvjNNvlzjjlM /BBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:reply-to:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date; bh=7m2WWC7EKFD/OuIjoeoYwgrC33FclKTqd8PtL8N/Ybc=; b=zovwbK356Ir8au9vvhlKOjxmZNfmD9kHzVjYKLBr6v1DUhA+mVEw7EeCBiP+q5y1Lk qoni4asskFUvQcDErohsl9NCfKRvUN0zYW25MMkO4B1YB99CzAhwLV1SC2wSGClFLXKV 7mBnQeEbaZvkIjPE//IPDvvJNbBcWu/HlYSFM9RWhbbiH+ekxILryCpOZe8m/YxmeaUP KHFW3fT0zBqeUOPr8JDDtYwADq9j1RiKE2q5QMecJovc+bzkSu59IjTXGNAWLsFGhPpL wzt2QqgrFE62TdkZ5yLhv5+V3q29gIbgoFYjDMzCtdbp4eSNuLwTnbHRy/ewBj0WiT5k +4Ow== X-Gm-Message-State: ACrzQf3kfH5OIriF82myBLQ+iVsCQteGFX7jKCyoN5siihDnV6mPtnE7 pc6oJMjA9qZQzwWuOdr73ERZqsNXxaLYyw== X-Google-Smtp-Source: AMsMyM5+F3QyPwG2v9O3EvTPm/pHHrcq+MpPgF2PzrZLVyLgbuhI902NXxvpx6xESQCuonoVoKkKYA== X-Received: by 2002:a05:6a00:2449:b0:528:3a29:e79d with SMTP id d9-20020a056a00244900b005283a29e79dmr1589030pfj.39.1663820218835; Wed, 21 Sep 2022 21:16:58 -0700 (PDT) Received: from [192.168.1.217] (157-131-207-86.fiber.dynamic.sonic.net. [157.131.207.86]) by smtp.gmail.com with ESMTPSA id q5-20020a170902edc500b0017534ffd491sm2833145plk.163.2022.09.21.21.16.58 for <bug-gnu-emacs@HIDDEN> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Sep 2022 21:16:58 -0700 (PDT) From: "Chris Hecker" <checker@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: 28.2; imenu doesn't differentiate overloaded c++ functions Date: Thu, 22 Sep 2022 04:16:55 +0000 Message-Id: <em9dbf9c23-ed96-4c46-88c5-cdd300b87fee@checker-blade15> User-Agent: eM_Client/8.2.1721.0 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------=_MBF02AFC7A-6506-4572-A127-E31F3A645F22" Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=checker@HIDDEN; helo=mail-pf1-x431.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: Chris Hecker <checker@HIDDEN> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) --------=_MBF02AFC7A-6506-4572-A127-E31F3A645F22 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable With this dumb c++ file: ---- int Function( int n ) { return n; } int Function( float v ) { return (int)(v + 0.5); } ---- Hitting imenu only gives a single Function entry. It should probably give two, maybe with a line number after them like "Function(123)" or whatever. Currently there's no way to get to the second Function from imenu. Thanks, Chris In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13 built on AVALON Windowing system distributor 'Microsoft Corp.', version 10.0.19044 System Description: Microsoft Windows 10 Home (v10.0.2009.19044.2006) Configured using: 'configure --with-modules --without-dbus --with-native-compilation --without-compress-install CFLAGS=3D-O2' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XPM ZLIB Important settings: value of $LANG: ENU locale-coding-system: cp1252 Major mode: C++//l Minor modes in effect: tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t abbrev-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug comp comp-cstr warnings rx cl-extra help-mode message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source eieio eieio-core cl-macs eieio-loaddefs password-cache json map text-property-search seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x misearch multi-isearch thingatpt cl-seq imenu vc-bzr vc-dispatcher cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 124613 8089) (symbols 48 9959 1) (strings 32 30565 2202) (string-bytes 1 1088980) (vectors 16 20627) (vector-slots 8 384011 13594) (floats 8 32 290) (intervals 56 529 0) (buffers 992 14)) --------=_MBF02AFC7A-6506-4572-A127-E31F3A645F22 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head> <style id=3D"css_styles">=20 blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px;= padding-right:0px; border-left: 1px solid #cccccc } blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px;= padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding= -top: 0px; } a img { border: 0px; } li[style=3D'text-align: center;'], li[style=3D'text-align: center; '], li[s= tyle=3D'text-align: right;'], li[style=3D'text-align: right; '] { list-sty= le-position: inside;} body { font-family: Segoe UI; font-size: 12pt; }=20 .quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb soli= d; padding-left: 0.3em; } </style> </head> <body><br />With this dumb c++ file:<br />----<br />int Function( int n ) {= <br />=C2=A0 return n;<br />}<br />int Function( float v ) {<br />=C2=A0 re= turn (int)(v + 0.5);<br />}<br />----<br /><br />Hitting imenu only gives a = single Function entry.=C2=A0 It should probably<br />give two, maybe with= a line number after them like "Function(123)" or<br />whatever.=C2=A0 Curre= ntly there's no way to get to the second Function from<div>imenu.<br /><br= />Thanks,<br />Chris<br /><br /><br />In GNU Emacs 28.2 (build 2, x86_64-w6= 4-mingw32)<br />=C2=A0of 2022-09-13 built on AVALON<br />Windowing system d= istributor 'Microsoft Corp.', version 10.0.19044<br />System Description: M= icrosoft Windows 10 Home (v10.0.2009.19044.2006)<br /><br />Configured usin= g:<br />=C2=A0'configure --with-modules --without-dbus --with-native-compil= ation<br />=C2=A0--without-compress-install CFLAGS=3D-O2'<br /><br />Config= ured features:<br />ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MOD= ULES NATIVE_COMP<br />NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF= TOOLKIT_SCROLL_BARS<br />XPM ZLIB<br /><br />Important settings:<br />=C2= =A0 value of $LANG: ENU<br />=C2=A0 locale-coding-system: cp1252<br /><br /= >Major mode: C++//l<br /><br />Minor modes in effect:<br />=C2=A0 tooltip-m= ode: t<br />=C2=A0 global-eldoc-mode: t<br />=C2=A0 show-paren-mode: t<br /= >=C2=A0 electric-indent-mode: t<br />=C2=A0 mouse-wheel-mode: t<br />=C2=A0 = tool-bar-mode: t<br />=C2=A0 menu-bar-mode: t<br />=C2=A0 file-name-shadow= -mode: t<br />=C2=A0 global-font-lock-mode: t<br />=C2=A0 font-lock-mode: t= <br />=C2=A0 blink-cursor-mode: t<br />=C2=A0 auto-composition-mode: t<br /= >=C2=A0 auto-encryption-mode: t<br />=C2=A0 auto-compression-mode: t<br />= =C2=A0 line-number-mode: t<br />=C2=A0 indent-tabs-mode: t<br />=C2=A0 tran= sient-mark-mode: t<br />=C2=A0 abbrev-mode: t<br /><br />Load-path shadows:= <br />None found.<br /><br />Features:<br />(shadow sort mail-extr emacsbug = comp comp-cstr warnings rx cl-extra<br />help-mode message rmc puny dired= dired-loaddefs rfc822 mml mml-sec epa<br />derived epg rfc6068 epg-config g= nus-util rmail rmail-loaddefs<br />auth-source eieio eieio-core cl-macs eie= io-loaddefs password-cache json<br />map text-property-search seq byte-opt= gv bytecomp byte-compile cconv<br />mm-decode mm-bodies mm-encode mail-pars= e rfc2231 mailabbrev gmm-utils<br />mailheader sendmail rfc2047 rfc2045 iet= f-drums mm-util mail-prsvr<br />mail-utils time-date subr-x misearch multi-= isearch thingatpt cl-seq<br />imenu vc-bzr vc-dispatcher cc-mode cc-fonts c= c-guess cc-menus cc-cmds<br />cc-styles cc-align cc-engine cc-vars cc-defs= cl-loaddefs cl-lib<br />iso-transl tooltip eldoc paren electric uniquify ed= iff-hook vc-hooks<br />lisp-float-type elisp-mode mwheel dos-w32 ls-lisp di= sp-table<br />term/w32-win w32-win w32-vars term/common-win tool-bar dnd fo= ntset image<br />regexp-opt fringe tabulated-list replace newcomment text-m= ode lisp-mode<br />prog-mode register page tab-bar menu-bar rfn-eshadow ise= arch easymenu<br />timer select scroll-bar mouse jit-lock font-lock syntax= font-core<br />term/tty-colors frame minibuffer cl-generic cham georgian ut= f-8-lang<br />misc-lang vietnamese tibetan thai tai-viet lao korean japanes= e eucjp-ms<br />cp51932 hebrew greek romanian slovak czech european ethiopi= c indian<br />cyrillic chinese composite emoji-zwj charscript charprop case= -table<br />epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded= nadvice<br />button loaddefs faces cus-face macroexp files window text-prop= erties<br />overlay sha1 md5 base64 format env code-pages mule custom widge= t<br />hashtable-print-readable backquote threads w32notify w32 lcms2 multi= -tty<br />make-network-process native-compile emacs)<br /><br />Memory info= rmation:<br />((conses 16 124613 8089)<br />=C2=A0(symbols 48 9959 1)<br />= =C2=A0(strings 32 30565 2202)<br />=C2=A0(string-bytes 1 1088980)<br />=C2= =A0(vectors 16 20627)<br />=C2=A0(vector-slots 8 384011 13594)<br />=C2=A0(= floats 8 32 290)<br />=C2=A0(intervals 56 529 0)<br />=C2=A0(buffers 992 14= ))<br /></div></body></html> --------=_MBF02AFC7A-6506-4572-A127-E31F3A645F22--
Chris Hecker <checker@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#57996
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.