From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: patch: add-log.el: changelog find file under point Date: Mon, 25 Feb 2008 15:05:01 +0100 Message-ID: <47C2CB0D.1060501@gmx.at> References: <1194211092.13041.13.camel@peder.flower> <200801222310.m0MN9cZq011601@sallyv1.ics.uci.edu> <8763xl492o.fsf@jurta.org> <200801230225.m0N2Ptmx012952@sallyv1.ics.uci.edu> <200801271954.m0RJsmBm003714@sallyv1.ics.uci.edu> <479DAC55.8070302@gmx.at> <200801300258.m0U2w9rr005169@sallyv1.ics.uci.edu> <47B9E0B1.1090908@gmx.at> <87skzpoqke.fsf@jurta.org> <47BA788E.7090406@gmx.at> <87mypv49oe.fsf@jurta.org> <47BD27B0.4060006@gmx.at> <47BF21CE.10607@gmx.at> <47C09F0A.2040906@gmx.at> <47C1F100.9090600@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1203948827 21576 80.91.229.12 (25 Feb 2008 14:13:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Feb 2008 14:13:47 +0000 (UTC) Cc: juri@jurta.org, bug-cc-mode@gnu.org, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 25 15:14:09 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JTe5T-0006Te-BX for ged-emacs-devel@m.gmane.org; Mon, 25 Feb 2008 15:13:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTe4x-0007Jh-AI for ged-emacs-devel@m.gmane.org; Mon, 25 Feb 2008 09:13:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JTe4s-0007HZ-2a for emacs-devel@gnu.org; Mon, 25 Feb 2008 09:13:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JTe4r-0007Fr-1K for emacs-devel@gnu.org; Mon, 25 Feb 2008 09:13:09 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTe4q-0007Fj-SK for emacs-devel@gnu.org; Mon, 25 Feb 2008 09:13:08 -0500 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JTe4q-0005Pc-CI for emacs-devel@gnu.org; Mon, 25 Feb 2008 09:13:08 -0500 Original-Received: (qmail invoked by alias); 25 Feb 2008 14:13:03 -0000 Original-Received: from N720P005.adsl.highway.telekom.at (EHLO [62.47.33.229]) [62.47.33.229] by mail.gmx.net (mp034) with SMTP; 25 Feb 2008 15:13:03 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/xHs0D2pDxAkUPi6WHuGc4u0f04Ej7kUnlEKl7IF SEB0SjUSBSDpef User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:90395 Archived-At: > Using a regexp is just one of the methods Imenu supports. > This would need special-purpose Lisp code, but it isn't very hard. Using a function would be much better but require a complete redesign of imenu support for c-mode. Also note that currently `cc-imenu-objc-generic-expression' depends on `cc-imenu-c++-generic-expression', hence we would have to decide about the former as well. So far I added the following to `cc-imenu-c++-generic-expression': (nil ,(concat "DEFUN[ \t]*(\"[" c-alnum "-]+\",[ \t]*" "\\([" c-alnum "_]+\\),[ \t]*[" c-alnum "_]+,[ \t\n]+" "\\(?:[ \t]*[0-9]+,\\)*\n" "[ \t]*doc:[ \t]*/\\*" "\\(?:[^*]+\\|\\*[^/]+\\)\\*/" "[ \t]*)") 1) This gets me a list of all Fcons, Flist, ... names provided they have been written well. It does _not_ remove the DEFUN entries and it does _not_ remove the entries in comments. A major cuplrit is the "[^()\n]*" ; no parentheses before line in `cc-imenu-c++-generic-expression' which is supposed to avoid leading parens. Obviously, this expression matches anything on a line if only the remainder of the line matches something like a function definition. Removing this line helps to redeem the problem. It doesn't help in the following cases: (1) Commented-out code. (2) Comments starting at bol. Even if an item is in a doc-string of a DEFUN it will be listed since the very nature of imenu regexp specifications means the DEFUN scan and that for normal functions are separate (with DEFUNs imenu will scan C-mode buffers up to six times). The latter scan _will_ report any function definition found on the bol of a doc-string handled by the former. (3) Strings starting at bol (you can see some nasty implications of this by running imenu on lib-src/etags.c). (4) An expression at bol like "while (0)" (you can find one in buffer.h, lisp.h, search.c, a couple in ccl.c). Using a function for Imenu + `syntax-ppss' could help us get rid of problems (1)-(3). It could also help to not list defs with leading parens. Things like (4) can then be either considered bad style or could be handled by applying certain heuristics. Writing a function obviously doesn't get me - macros like #define ... - type definitions like typedef union Lisp_Object - enumerations like enum Lisp_Type and many more automatically. All these are used in change-log entries and not finding them via imenu makes it hardly worth the effort to run imenu in the first place. (Please recall: This thread started out as finding a definiton from a corresponding change log entry.) Adding these would mostly require to reinvent things that have been written and validated in etags before.