From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas =?iso-8859-1?q?R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: Narrowing to non-adjacent regions Date: Fri, 1 Feb 2008 20:00:33 +0100 Message-ID: <200802012000.33596.andreas.roehler@online.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1201892379 9730 80.91.229.12 (1 Feb 2008 18:59:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Feb 2008 18:59:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 01 19:59:59 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JL172-0003TH-4u for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Feb 2008 19:59:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JL16a-0001wh-Nb for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Feb 2008 13:59:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JL16N-0001wP-4C for help-gnu-emacs@gnu.org; Fri, 01 Feb 2008 13:59:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JL16L-0001w0-LU for help-gnu-emacs@gnu.org; Fri, 01 Feb 2008 13:59:02 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JL16L-0001vx-EU for help-gnu-emacs@gnu.org; Fri, 01 Feb 2008 13:59:01 -0500 Original-Received: from moutng.kundenserver.de ([212.227.126.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JL16K-0003DX-Qd for help-gnu-emacs@gnu.org; Fri, 01 Feb 2008 13:59:01 -0500 Original-Received: from noname (p54BEBB18.dip0.t-ipconnect.de [84.190.187.24]) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis) id 0MKwpI-1JL16J16Xk-0007gE; Fri, 01 Feb 2008 19:58:59 +0100 User-Agent: KMail/1.9.5 In-Reply-To: Content-Disposition: inline X-Provags-ID: V01U2FsdGVkX1983DXcVlIx4k8sEZveVEFD1CnICHIsfTs9RBf /uJGnq1hCHV4PII38hZIXy5Gs9dgmnaw87BTgQ7S6Pbjp1AEQg wxYgO04tbqss7vNc3l8kQ== X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) 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:51165 Archived-At: Am Mittwoch, 30. Januar 2008 20:42 schrieb davidjneu@gmail.com: > Hi, > > Hi, I'm wondering if it's possible to narrow a buffer so that multiple > non-adjacent > regions are displayed. > > The code snippet below doesn't work, but conveys what I'm looking for. > > Many thanks! > > Cheers, > David > > (defun narrow-two () > (interactive "*") > (widen) > (goto-char (point-min)) > (let ((start-1 (point)) > (end-1 (progn (next-line 5) (point))) > (start-2 (progn (next-line 7) (point))) > (end-2 (progn (end-of-buffer) (point)))) > (narrow-to-region start-1 end-1) > (narrow-to-region start-2 end-2))) > _______________________________________________ here is multi-region.el working right out of the box. http://www.ph.ed.ac.uk/~s0198183/multi-region.el It comes with a command ,---- | (defun multi-region-execute-command (&optional arg cmd) | "Perform a command on all active multi-regions. `---- Remains just to revert that, making it work at all non-active parts. Andreas R=F6hler