From: martin rudalics <rudalics@gmx.at>
To: rms@gnu.org
Cc: juri@jurta.org, bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: patch: add-log.el: changelog find file under point
Date: Mon, 25 Feb 2008 15:05:01 +0100 [thread overview]
Message-ID: <47C2CB0D.1060501@gmx.at> (raw)
In-Reply-To: <E1JTb1N-0007Wy-Oz@fencepost.gnu.org>
> 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.
next prev parent reply other threads:[~2008-02-25 14:05 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-04 21:18 patch: add-log.el: changelog find file under poin Jan Nieuwenhuizen
2007-11-06 23:45 ` Juri Linkov
2007-11-07 13:38 ` Jan Nieuwenhuizen
2007-11-09 8:40 ` Dan Nicolaescu
2007-11-09 9:40 ` Juri Linkov
2008-01-20 6:14 ` Richard Stallman
2008-01-21 3:02 ` Glenn Morris
2008-01-21 20:30 ` Richard Stallman
2008-01-21 20:35 ` Glenn Morris
2008-01-22 22:29 ` Richard Stallman
2008-01-22 22:38 ` Glenn Morris
2008-01-22 23:09 ` Dan Nicolaescu
2008-01-23 1:32 ` Juri Linkov
2008-01-23 2:25 ` Dan Nicolaescu
2008-01-23 9:28 ` Juri Linkov
2008-01-23 16:20 ` Richard Stallman
2008-01-27 19:54 ` Dan Nicolaescu
2008-01-28 10:20 ` martin rudalics
2008-01-30 2:58 ` Dan Nicolaescu
2008-02-18 19:46 ` patch: add-log.el: changelog find file under point martin rudalics
2008-02-18 20:09 ` Unbearably slow editing in .h files (was: patch: add-log.el: changelog find file under point) Stefan Monnier
2008-02-23 22:49 ` Alan Mackenzie
2008-02-23 22:51 ` Unbearably slow editing in .h files martin rudalics
2008-02-23 23:25 ` Alan Mackenzie
2008-02-24 8:55 ` martin rudalics
2008-04-02 22:07 ` Alan Mackenzie
2008-04-02 23:47 ` Dan Nicolaescu
2008-04-03 9:14 ` Alan Mackenzie
2008-04-03 13:10 ` Dan Nicolaescu
2008-04-03 14:17 ` Alan Mackenzie
2008-04-03 15:22 ` Dan Nicolaescu
2008-04-03 17:58 ` Alan Mackenzie
2008-02-24 0:37 ` Stefan Monnier
2008-02-24 8:39 ` Alan Mackenzie
2008-02-24 14:46 ` Jason Rumney
2008-02-24 19:48 ` Eli Zaretskii
2008-02-24 19:49 ` Eli Zaretskii
2008-02-24 10:28 ` Andreas Schwab
2008-02-24 13:49 ` Stefan Monnier
2008-02-24 14:41 ` Alan Mackenzie
2008-02-24 15:42 ` Stefan Monnier
2008-02-24 20:12 ` Alan Mackenzie
2008-02-24 22:29 ` Richard Stallman
2008-02-25 2:14 ` Stefan Monnier
2008-02-18 23:31 ` patch: add-log.el: changelog find file under point Juri Linkov
2008-02-19 6:34 ` martin rudalics
2008-02-20 21:29 ` Juri Linkov
2008-02-21 7:26 ` martin rudalics
2008-02-21 22:29 ` Richard Stallman
2008-02-22 19:26 ` martin rudalics
2008-02-23 19:28 ` Richard Stallman
2008-02-23 22:32 ` martin rudalics
2008-02-24 15:23 ` Richard Stallman
2008-02-24 15:23 ` Richard Stallman
2008-02-24 22:34 ` martin rudalics
2008-02-25 10:57 ` Richard Stallman
2008-02-25 14:05 ` martin rudalics [this message]
2008-01-22 0:08 ` patch: add-log.el: changelog find file under poin Juri Linkov
2008-01-22 1:17 ` Drew Adams
2008-01-22 9:54 ` Juri Linkov
2008-01-22 14:34 ` Drew Adams
2008-01-22 22:29 ` Richard Stallman
2008-01-23 1:29 ` Juri Linkov
2008-01-23 16:20 ` Richard Stallman
2008-01-28 8:55 ` Jan Nieuwenhuizen
2008-01-28 9:29 ` Johan Bockgård
2008-01-22 8:21 ` Dan Nicolaescu
2008-01-22 9:56 ` Juri Linkov
2008-01-22 23:13 ` Dan Nicolaescu
2008-01-22 22:29 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47C2CB0D.1060501@gmx.at \
--to=rudalics@gmx.at \
--cc=bug-cc-mode@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=juri@jurta.org \
--cc=rms@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.