From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: Narrow buffer to the results of an isearch? Date: Fri, 07 Oct 2005 16:37:28 GMT Organization: EarthLink Inc. -- http://www.EarthLink.net Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1128703375 22103 80.91.229.2 (7 Oct 2005 16:42:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 7 Oct 2005 16:42:55 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 07 18:42:47 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ENvI1-0007Tl-DO for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Oct 2005 18:41:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ENvI0-0008Ug-Q2 for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Oct 2005 12:41:44 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread3.news.atl.earthlink.net.POSTED!0847253b!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Original-NNTP-Posting-Host: 4.159.32.35 Original-X-Complaints-To: abuse@earthlink.net Original-X-Trace: newsread3.news.atl.earthlink.net 1128703048 4.159.32.35 (Fri, 07 Oct 2005 09:37:28 PDT) Original-NNTP-Posting-Date: Fri, 07 Oct 2005 09:37:28 PDT Original-Xref: shelby.stanford.edu gnu.emacs.help:134458 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:30037 Archived-At: "Ryan Newton" 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