unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Narrow buffer to the results of an isearch?
@ 2005-10-07 15:39 Ryan Newton
  2005-10-07 16:34 ` Slawomir Nowaczyk
  2005-10-07 16:50 ` Kevin Rodgers
  0 siblings, 2 replies; 7+ messages in thread
From: Ryan Newton @ 2005-10-07 15:39 UTC (permalink / raw)


Maybe this is impossible, I certainly haven't found anything on it yet.

What I want is to mask the current buffer to all lines matching an  
search.  Unfortunately I don't know if narrow-to-region can be used  
for this, because the region is defined as a continuous area of text  
between the mark and the point.

Has anyone hacked up support for discontinuous regions?  Or some  
other way that I can filter the buffer to only my lines of interest?

--Ryan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Narrow buffer to the results of an isearch?
  2005-10-07 15:39 Ryan Newton
@ 2005-10-07 16:34 ` Slawomir Nowaczyk
  2005-10-07 16:50 ` Kevin Rodgers
  1 sibling, 0 replies; 7+ messages in thread
From: Slawomir Nowaczyk @ 2005-10-07 16:34 UTC (permalink / raw)


On Fri, 07 Oct 2005 11:39:18 -0400
Ryan Newton <rrnewton@gmail.com> wrote:

#> Maybe this is impossible, I certainly haven't found anything on it yet.
#> 
#> What I want is to mask the current buffer to all lines matching an  
#> search.  Unfortunately I don't know if narrow-to-region can be used  
#> for this, because the region is defined as a continuous area of text  
#> between the mark and the point.
#> 
#> Has anyone hacked up support for discontinuous regions?  Or some  
#> other way that I can filter the buffer to only my lines of interest?

Depending on what do you want to do with the buffer, M-x occur might
work for you. And there is also an outline mode which you could look
into.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

You can get a lot more done with a kind word and a gun than with
a kind word alone.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Narrow buffer to the results of an isearch?
       [not found] <mailman.10276.1128699759.20277.help-gnu-emacs@gnu.org>
@ 2005-10-07 16:37 ` B. T. Raven
  2005-10-07 17:16 ` David Hansen
  1 sibling, 0 replies; 7+ messages in thread
From: B. T. Raven @ 2005-10-07 16:37 UTC (permalink / raw)



"Ryan Newton" <rrnewton@gmail.com> wrote in message
news:mailman.10276.1128699759.20277.help-gnu-emacs@gnu.org...
> Maybe this is impossible, I certainly haven't found anything on it
yet.
>
> What I want is to mask the current buffer to all lines matching an
> search.  Unfortunately I don't know if narrow-to-region can be used
> for this, because the region is defined as a continuous area of text
> between the mark and the point.
>
> Has anyone hacked up support for discontinuous regions?  Or some
> other way that I can filter the buffer to only my lines of interest?
>
> --Ryan
>
>
>

Since the emacs buffer is only a copy of the visited file, you could
shell out to the operating system, run 'sed' (Unix stream editor) on the
file, pipe the output to temp, and then read temp into another buffer,
or even insert it into or append it to the original buffer. It might
even be possible to automate this entire process with a little help from
elisp and your friends. Rather than isearch, you will probably want to
use the more powerful search regexp.

Ed

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Narrow buffer to the results of an isearch?
  2005-10-07 15:39 Ryan Newton
  2005-10-07 16:34 ` Slawomir Nowaczyk
@ 2005-10-07 16:50 ` Kevin Rodgers
  2005-10-07 17:18   ` Ryan Newton
  1 sibling, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2005-10-07 16:50 UTC (permalink / raw)


Ryan Newton wrote:
> Maybe this is impossible, I certainly haven't found anything on it yet.
> 
> What I want is to mask the current buffer to all lines matching an  
> search.  Unfortunately I don't know if narrow-to-region can be used  for 
> this, because the region is defined as a continuous area of text  
> between the mark and the point.
> 
> Has anyone hacked up support for discontinuous regions?  Or some  other 
> way that I can filter the buffer to only my lines of interest?

M-x occur

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Narrow buffer to the results of an isearch?
       [not found] <mailman.10276.1128699759.20277.help-gnu-emacs@gnu.org>
  2005-10-07 16:37 ` Narrow buffer to the results of an isearch? B. T. Raven
@ 2005-10-07 17:16 ` David Hansen
  1 sibling, 0 replies; 7+ messages in thread
From: David Hansen @ 2005-10-07 17:16 UTC (permalink / raw)


On Fri, 7 Oct 2005 11:39:18 -0400 Ryan Newton wrote:

> What I want is to mask the current buffer to all lines matching an
> search.  Unfortunately I don't know if narrow-to-region can be used
> for this, because the region is defined as a continuous area of text
> between the mark and the point.

Maybe this helps:

http://www.emacswiki.org/cgi-bin/wiki/HideLines

(defun hide-non-matching-lines (search-text)
  "Hide lines that don't match the specified regexp." ...

David

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Narrow buffer to the results of an isearch?
  2005-10-07 16:50 ` Kevin Rodgers
@ 2005-10-07 17:18   ` Ryan Newton
  2005-10-07 18:43     ` Lennart Borgman
  0 siblings, 1 reply; 7+ messages in thread
From: Ryan Newton @ 2005-10-07 17:18 UTC (permalink / raw)
  Cc: help-gnu-emacs

Thanks, M-x occur is pretty good.  I can see them all together, and  
editing them isn't too hard.

B.T. Raven, I would hesitate to try to sed-out a separate buffer for  
fear of it being difficult to reinsert.  (But by just including line  
numbers in the sed output and reinserting at those line numbers,  
maybe it wouldn't be so bad...)

Thanks all,
--Ryan

On Oct 7, 2005, at 12:50 PM, Kevin Rodgers wrote:

> Ryan Newton wrote:
>
>> Maybe this is impossible, I certainly haven't found anything on it  
>> yet.
>> What I want is to mask the current buffer to all lines matching  
>> an  search.  Unfortunately I don't know if narrow-to-region can be  
>> used  for this, because the region is defined as a continuous area  
>> of text  between the mark and the point.
>> Has anyone hacked up support for discontinuous regions?  Or some   
>> other way that I can filter the buffer to only my lines of interest?
>>
>
> M-x occur
>
> -- 
> Kevin Rodgers
>
>
>
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Narrow buffer to the results of an isearch?
  2005-10-07 17:18   ` Ryan Newton
@ 2005-10-07 18:43     ` Lennart Borgman
  0 siblings, 0 replies; 7+ messages in thread
From: Lennart Borgman @ 2005-10-07 18:43 UTC (permalink / raw)
  Cc: Kevin Rodgers, help-gnu-emacs

There is a page on http://www.emacswiki.org/ about occur and moccur that 
I believe could be interesting. If I remember correctly there is even a 
way to edit the results from an moccur search. Quite nice!

-- Lennart


Ryan Newton wrote:

> Thanks, M-x occur is pretty good.  I can see them all together, and  
> editing them isn't too hard.
>
> B.T. Raven, I would hesitate to try to sed-out a separate buffer for  
> fear of it being difficult to reinsert.  (But by just including line  
> numbers in the sed output and reinserting at those line numbers,  
> maybe it wouldn't be so bad...)
>
> Thanks all,
> --Ryan
>
> On Oct 7, 2005, at 12:50 PM, Kevin Rodgers wrote:
>
>> Ryan Newton wrote:
>>
>>> Maybe this is impossible, I certainly haven't found anything on it  
>>> yet.
>>> What I want is to mask the current buffer to all lines matching  an  
>>> search.  Unfortunately I don't know if narrow-to-region can be  
>>> used  for this, because the region is defined as a continuous area  
>>> of text  between the mark and the point.
>>> Has anyone hacked up support for discontinuous regions?  Or some   
>>> other way that I can filter the buffer to only my lines of interest?
>>>
>>
>> M-x occur
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-10-07 18:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.10276.1128699759.20277.help-gnu-emacs@gnu.org>
2005-10-07 16:37 ` Narrow buffer to the results of an isearch? B. T. Raven
2005-10-07 17:16 ` David Hansen
2005-10-07 15:39 Ryan Newton
2005-10-07 16:34 ` Slawomir Nowaczyk
2005-10-07 16:50 ` Kevin Rodgers
2005-10-07 17:18   ` Ryan Newton
2005-10-07 18:43     ` Lennart Borgman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).