From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#57996: 28.2; imenu doesn't differentiate overloaded c++ functions Date: Wed, 5 Oct 2022 10:31:11 +0000 Message-ID: References: <87v8p22wsz.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29325"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Chris Hecker , 57996@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 05 12:32:57 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1og1hx-0007Vw-Ra for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 12:32:57 +0200 Original-Received: from localhost ([::1]:39916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1og1hw-00059K-DG for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 06:32:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1og1h4-00055i-Ml for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 06:32:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56912) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1og1h4-0008DU-Dq for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 06:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1og1h4-0005VK-93 for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 06:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Oct 2022 10:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57996 X-GNU-PR-Package: emacs Original-Received: via spool by 57996-submit@debbugs.gnu.org id=B57996.166496588421111 (code B ref 57996); Wed, 05 Oct 2022 10:32:02 +0000 Original-Received: (at 57996) by debbugs.gnu.org; 5 Oct 2022 10:31:24 +0000 Original-Received: from localhost ([127.0.0.1]:55990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1og1gR-0005UR-4E for submit@debbugs.gnu.org; Wed, 05 Oct 2022 06:31:23 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]:58186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1og1gN-0005UA-Go for 57996@debbugs.gnu.org; Wed, 05 Oct 2022 06:31:22 -0400 Original-Received: (qmail 62564 invoked by uid 3782); 5 Oct 2022 12:31:12 +0200 Original-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 Original-Received: (qmail 8989 invoked by uid 1000); 5 Oct 2022 10:31:11 -0000 Content-Disposition: inline In-Reply-To: <87v8p22wsz.fsf@posteo.net> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:244506 Archived-At: Hello, Chris and Philip. On Sun, Oct 02, 2022 at 13:13:16 +0000, Philip Kaludercic wrote: > "Chris Hecker" 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).