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 15:27:52 +0100 Message-ID: <200802011527.52590.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 1201876115 12327 80.91.229.12 (1 Feb 2008 14:28:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Feb 2008 14:28:35 +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 15:28:56 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 1JKwsr-00023r-OD for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Feb 2008 15:28:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKwsQ-0006Oi-7n for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Feb 2008 09:28:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKwqd-0005FQ-0P for help-gnu-emacs@gnu.org; Fri, 01 Feb 2008 09:26:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKwqb-0005Eh-8I for help-gnu-emacs@gnu.org; Fri, 01 Feb 2008 09:26:30 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKwqb-0005Ea-2P for help-gnu-emacs@gnu.org; Fri, 01 Feb 2008 09:26:29 -0500 Original-Received: from moutng.kundenserver.de ([212.227.126.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKwqa-0000iW-NG for help-gnu-emacs@gnu.org; Fri, 01 Feb 2008 09:26:29 -0500 Original-Received: from noname (p54BEBB18.dip0.t-ipconnect.de [84.190.187.24]) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis) id 0ML29c-1JKwqM2JWg-000748; Fri, 01 Feb 2008 15:26:14 +0100 User-Agent: KMail/1.9.5 In-Reply-To: Content-Disposition: inline X-Provags-ID: V01U2FsdGVkX1/oYv3cU3FHsGB1xzdTYxRWcExKWMZKfEpe3Rd CBYUKtpU3EM6rmWWTOPsSw/8HLA5Rt/ZXXsPwqpF40VQaNa2Pl JZIa2NI2YCfotIw1Q+V9Q== 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:51158 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))) > _______________________________________________ As GNU Emacs enables only a single region at time AFAIK, you'll need another tool to do this. Already exists block.el, look, if it is suitable. Once several blocks are known, set the remaining chars to invisible. Maybe block.el delivers that already. HTH Andreas R=F6hler