* commands to remove commented lines from grep output
@ 2007-07-02 6:10 Drew Adams
2007-07-02 22:40 ` Richard Stallman
0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2007-07-02 6:10 UTC (permalink / raw)
To: Emacs-Devel
I sometimes want to see grep matches only for lines of code that are not
commented out. At least for the simple case of single line comment syntax,
such as `;' in Lisp and `//' in C++, this is easy to do with `flush-lines'.
To make this a little more convenient, I bind a more specific command that
does this to `;' in *grep* buffers. Another command, bound to `M-;', toggles
automatic removal of such commented lines.
How about adding such a feature to Emacs? The code I use is in library
grep+.el: http://www.emacswiki.org/cgi-bin/wiki/grep%2b.el. There are
additional features in that library, such as flexible defaulting of the grep
regexp, but I don't necessarily propose them for Emacs.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: commands to remove commented lines from grep output
2007-07-02 6:10 commands to remove commented lines from grep output Drew Adams
@ 2007-07-02 22:40 ` Richard Stallman
2007-07-02 22:58 ` Drew Adams
0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2007-07-02 22:40 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
I sometimes want to see grep matches only for lines of code that are not
commented out. At least for the simple case of single line comment syntax,
such as `;' in Lisp and `//' in C++, this is easy to do with `flush-lines'.
As a general feature, it seems useful.
To make this a little more convenient, I bind a more specific command that
does this to `;' in *grep* buffers. Another command, bound to `M-;', toggles
automatic removal of such commented lines.
I am not sure I like that interface for it. Also, it doesn't work for C.
It could be made to work for C with more code, which would involve
reading the source files and checking whether the lines found are
inside comments.
It seems to me that a new grep option might be a better approach.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: commands to remove commented lines from grep output
2007-07-02 22:40 ` Richard Stallman
@ 2007-07-02 22:58 ` Drew Adams
2007-07-04 3:43 ` Richard Stallman
0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2007-07-02 22:58 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
> I sometimes want to see grep matches only for lines of code
> that are not commented out. At least for the simple case of
> single line comment syntax, such as `;' in Lisp and `//' in
> C++, this is easy to do with `flush-lines'.
>
> As a general feature, it seems useful.
>
> To make this a little more convenient, I bind a more specific
> command that does this to `;' in *grep* buffers. Another command,
> bound to `M-;', toggles automatic removal of such commented lines.
>
> I am not sure I like that interface for it. Also, it doesn't work for C.
> It could be made to work for C with more code, which would involve
> reading the source files and checking whether the lines found are
> inside comments.
>
> It seems to me that a new grep option might be a better approach.
Do you mean, for example, automatically tweaking the regexp supplied to
grep, so that commented lines are not included? That would be good,
especially if it could handle lines commented between /* and */ (for C). It
would still be good to supply a toggle for this automatic removal.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: commands to remove commented lines from grep output
2007-07-02 22:58 ` Drew Adams
@ 2007-07-04 3:43 ` Richard Stallman
0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2007-07-04 3:43 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
> It seems to me that a new grep option might be a better approach.
Do you mean, for example, automatically tweaking the regexp supplied to
grep, so that commented lines are not included?
I meant a new grep command line option to check for comments.
But maybe your approach is better, as long as it is extended
to handle multi-line comment syntaxes.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-04 3:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-02 6:10 commands to remove commented lines from grep output Drew Adams
2007-07-02 22:40 ` Richard Stallman
2007-07-02 22:58 ` Drew Adams
2007-07-04 3:43 ` Richard Stallman
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.