From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.devel Subject: Re: widen-one-level [was: Emacs's handling of line numbers] Date: Mon, 19 Apr 2010 18:57:18 +0100 Organization: University of Cambridge Message-ID: References: <837ho6czb6.fsf@gnu.org> <8339yucbsg.fsf@gnu.org> <83wrw5bxkc.fsf@gnu.org> <90D3EB66AA37491881EB2B26100925C2@us.oracle.com> <7DAA22BBC7FD45D9996D3EE994E01C16@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1271700694 19309 80.91.229.12 (19 Apr 2010 18:11:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 19 Apr 2010 18:11:34 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 19 20:11:30 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O3vRP-0000z3-Np for ged-emacs-devel@m.gmane.org; Mon, 19 Apr 2010 20:11:28 +0200 Original-Received: from localhost ([127.0.0.1]:38893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3vRP-0004ee-4Q for ged-emacs-devel@m.gmane.org; Mon, 19 Apr 2010 14:11:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3vE4-0001lC-EX for emacs-devel@gnu.org; Mon, 19 Apr 2010 13:57:41 -0400 Original-Received: from [140.186.70.92] (port=42633 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3vDy-0001iu-Uk for emacs-devel@gnu.org; Mon, 19 Apr 2010 13:57:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3vDt-000217-14 for emacs-devel@gnu.org; Mon, 19 Apr 2010 13:57:30 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:50997) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O3vDs-00020j-Mv for emacs-devel@gnu.org; Mon, 19 Apr 2010 13:57:28 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1O3vDr-0001U3-9m for emacs-devel@gnu.org; Mon, 19 Apr 2010 19:57:27 +0200 Original-Received: from smaug.linux.pwf.cam.ac.uk ([193.60.95.72]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 19 Apr 2010 19:57:27 +0200 Original-Received: from sdl.web by smaug.linux.pwf.cam.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 19 Apr 2010 19:57:27 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 26 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: smaug.linux.pwf.cam.ac.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:x1tXbyBbXe4otv/a5ZJsmCzFfcc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:123886 Archived-At: On 2010-04-19 17:31 +0100, Drew Adams wrote: >> Or something like that. Someone more knowledgable will no >> doubt enlighten us. > > One (ugly) solution is to copy the Lisp source code for `narrow-to-defun' and > `narrow-to-page' to the same library that advises `narrow-to-region'. That way, > the advised definition is used also for the other two. Yes. I suspect defadvice will do too. My original idea was to implement some sort of undo for narrowing using a ring structure and have narrow-to-region record that info for me. Because of this (which I think is ugly) I abandoned the plan. In the end I implemented something that needs a user to explicitly record the state (bound to C-x n r). The use case for me is this: suppose I am writing an around 50 page article in LaTeX and I don't feel like splitting it into multiple files. But during writing I only want to focus on a portion of the article (a section for example), I can narrow to that section and record that state so that C-x n w will not expose me to the entire file. I posted my code here http://paste.lisp.org/display/97993. Leo