From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.bugs Subject: bug#36678: 27.0.50; imenu not working in C++ (maybe because of namespace) Date: Wed, 31 Jul 2019 17:56:13 +0200 Message-ID: <20190731155610.x33urisumbblyryu@Ergus> References: <20190717163427.18177.qmail@mail.muc.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="6688"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: 36678@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 31 17:58:32 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hsqzo-0001Xw-7K for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Jul 2019 17:58:32 +0200 Original-Received: from localhost ([::1]:42056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsqzn-0002Sq-32 for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Jul 2019 11:58:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37644) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsqyS-0000sF-4t for bug-gnu-emacs@gnu.org; Wed, 31 Jul 2019 11:57:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsqyQ-0004Hh-Uh for bug-gnu-emacs@gnu.org; Wed, 31 Jul 2019 11:57:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44125) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsqyL-0004EF-OX; Wed, 31 Jul 2019 11:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hsqyL-0003QM-L4; Wed, 31 Jul 2019 11:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 31 Jul 2019 15:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36678 X-GNU-PR-Package: emacs,cc-mode Original-Received: via spool by 36678-submit@debbugs.gnu.org id=B36678.156458859213112 (code B ref 36678); Wed, 31 Jul 2019 15:57:01 +0000 Original-Received: (at 36678) by debbugs.gnu.org; 31 Jul 2019 15:56:32 +0000 Original-Received: from localhost ([127.0.0.1]:52943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hsqxq-0003PN-9g for submit@debbugs.gnu.org; Wed, 31 Jul 2019 11:56:32 -0400 Original-Received: from sonic314-19.consmr.mail.ir2.yahoo.com ([77.238.177.145]:32810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hsqxo-0003P7-5F for 36678@debbugs.gnu.org; Wed, 31 Jul 2019 11:56:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1564588580; bh=8KUU41qc0kv0uUXWnii+rmPpRMmT/vhvKbG/Pl/7ecc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=aHjE1TeX5ffyLMxDGyGzuRsRYYbuX7BTV3XH1VqJDwmyUztS5KW+EflD92BQ+Q7hhmm+EfBuriFWs1OWWG340tV/Brw/rSv2zesLQflKfT3KJn+CC6XowvYH6AsByNcWKO0WbZfqZIxtMH9+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BbEHfgLaL Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.ir2.yahoo.com with HTTP; Wed, 31 Jul 2019 15:56:20 +0000 Original-Received: by smtp418.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 30201d61e9e8114a89c041717c2561ab; Wed, 31 Jul 2019 15:56:15 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20190717163427.18177.qmail@mail.muc.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164173 Archived-At: Hi Alan: Sorry for the long delay replying this. I have been thinking on this for a while because this issue affects me constantly as I use most of the time C++ now. Maybe this is a stupid suggestion, but I was thinking that if the issue is performance (for ii) we could add a special function to implement the expensive part for the functional search in C and use the C regexps. Maybe it could be restrictive somehow, but if this solves a problem, could be good enough and important for C++-mode. Because namespace use is becoming more and more extended in C++ with the new standards. And the most common indentations are the Probably: 1) For example it could do a first filtration for the buffer in a C function using C regexp (with fake positives) and then filter again in the Lisp side? 2) Or, we could just iterate the file by lines in C and then modify the regex for the next line conditionally (which is cheaper than in Lisp). This could create a list in C that we can then use in the Lisp side more efficiently. In case we figure out a nice method for that. Does it makes sense? On Wed, Jul 17, 2019 at 04:34:27PM -0000, Alan Mackenzie wrote: >Hello again, Ergus. > >In article you wrote: >> [-- text/plain, encoding 7bit, charset: us-ascii, 91 lines --] > >> --text follows this line-- > >> In the example code (attachement) imenu does not recognizes the >> functions. So it shows that there are not candidates when there are. > >[ .... ] > >> Major mode: C++//l > >The problem is that the function names are not at column zero. If they >were, they'd get recognised properly. If CC Mode's imenu were to >recognise indented functions there'd be too many false positives. > >This problem has actually come up before (on 2016-11-25, in a post to the >CC Mode list by Jens Kjerrstr?m), and I then hacked up three defuns which >would search for functions functionally rather than by regexp. This >wasn't wholly satisfactory since (i) this searching was slow; and (ii) if >there were two functions of the same name (e.g., in different >namespaces), imenu would only find the first one in the buffer. > >If you are interested, I could send you this hack, which is not all that >big. Maybe you could play around with it and make it work well. > >Maybe it would be possible to bring this approach up to a usable part of >CC Mode - possibly solving (ii) by constructing a hierarchical menu, but >problem (i) would remain. In any case this would be a substantial >enhancement rather than a simple bug fix. > >[ .... ] > >> [-- text/plain, encoding 7bit, charset: us-ascii, 45 lines, name: make_local_matrix.hpp --] > >> #ifndef _make_local_matrix_hpp_ >> #define _make_local_matrix_hpp_ > >> #include >> #include > >> #include >> #include > >> #include > > >> namespace miniFE { > > >> void get_recv_info_task(CSRMatrix *A, size_t id, size_t numboxes >> const size_t *nrows_array, >> size_t Annz, size_t Anrows) >> { > >> } > > >> void get_send_info_task(CSRMatrix *A, size_t id, >> size_t numboxes, >> int *send_length_local) >> { >> } > > >> void set_send_info_task(CSRMatrix *A_array, size_t id, >> size_t numboxes, >> int nelements_to_send_local, >> int *elements_to_send_local) >> { >> } > >> void make_local_matrix(CSRMatrix *A_array, singleton *sing, size_t numboxes) >> { >> } > >> }//namespace miniFE > >> #endif > >-- >Alan Mackenzie (Nuremberg, Germany). >