help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Negative occur


From: Drew Adams
Subject: RE: Negative occur
Date: Wed, 28 Nov 2007 09:03:17 -0800

> > > Is there a command like occur which shows non-matching lines? It would
> > > come in handy for me for the work I'm doing.
> >
> > > It's a useful a feature and not hard to implement, so I'm sure it's
> > > already in Emacs in some form only I'm overlooking it.
> >
> > You could try running "occur" with the pattern "^" (which matches
> > every line), then prune the results with M-x delete-matching-lines RET
>
> Yep, there are workarounds. :) But it seems a very basic feature,
> so I'd be surprised if Emacs didn't have it. We have keep-lines
> and flush-lines after all, so it would be logical to have the
> same for occur.

I realize that your suggestion is that this be added to Emacs. I agree.

FYI - In Icicles, just do this:  C-' foobar C-~

That shows and lets you visit all lines that do not match the regexp
"foobar". `C-'' is `icicle-occur'. `C-~' complements the current set of
matches.

You can also then match additional regexps, dynamically, just by typing
them, separated by `S-SPC' or `C-~'. `S-SPC' means AND (set intersection)
and `C-~' means AND NOT (set complement). Each applies to the current set of
matches. Example:

 C-' foobar C-~ toto S-SPC titi C-~ tata

That shows and lets you visit all lines that do not contain "foobar", do
contain "toto", do not contain "titi", and do contain "tata". You get the
idea: you can get what you want by progressively narrowing the search space.

http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Search_Commands%2c_Overview






reply via email to

[Prev in Thread] Current Thread [Next in Thread]