From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: narrowing considered harmful (was: putting double quotes efficiently) Date: Thu, 13 Jun 2013 10:40:01 -0400 Organization: A noiseless patient Spider Message-ID: References: <51AC4543.1000508@easy-emacs.de> <51AC4C03.7050504@easy-emacs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1371138711 30446 80.91.229.3 (13 Jun 2013 15:51:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Jun 2013 15:51:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 13 17:51:52 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Un9oO-0000M8-O2 for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Jun 2013 17:51:44 +0200 Original-Received: from localhost ([::1]:50574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un9oN-00024A-Gg for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Jun 2013 11:51:43 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 15 Injection-Info: mx05.eternal-september.org; posting-host="159116255ce7d0b522977afcd6e918a8"; logging-data="20656"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Z8zFuxD4mhBits55OLSQb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:65BkPIPt5DwO0g9S1Plc9wBpYKc= sha1:68ZRNOePwEKq8ZwODnlQt13l9Ug= Original-Xref: usenet.stanford.edu gnu.emacs.help:199246 X-Mailman-Approved-At: Thu, 13 Jun 2013 11:49:51 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91516 Archived-At: BTW, I tend to consider narrow-to-region in Elisp as a problem,so I encourage you to write your code without it. In your example, you don't need to narrow: the only thing you need is to keep the "end" updated when the buffer is modified, which is easy to do by changing the "end" form an integer to a marker. Or alternatively, you can simply work your way backward, in which case you don't need to worry about using a marker since the "start" position to which you're going won't be affected by the buffer modifications. Stefan