From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Version 7.5: C-c C-t fails with "args out of range" Date: Wed, 09 Mar 2011 10:59:15 +0100 Message-ID: <87bp1ky5qk.fsf@gnu.org> References: <87sjuw973f.wl%dmaus@ictsoc.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=38771 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxGB6-0004uf-Hw for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 04:59:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxGB5-0001lY-As for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 04:59:36 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:58194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxGB5-0001lU-1H for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 04:59:35 -0500 Received: by wwc33 with SMTP id 33so295699wwc.30 for ; Wed, 09 Mar 2011 01:59:34 -0800 (PST) In-Reply-To: <87sjuw973f.wl%dmaus@ictsoc.de> (David Maus's message of "Wed, 09 Mar 2011 06:49:08 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Maus Cc: emacs-orgmode@gnu.org, Josh Berry Hi David, David Maus writes: > What if BODY inserts or deletes characters inside the narrowed region? > In this case the upper boundary of the region is no longer (point-max) > before executing body. Thus the buffer might be narrowed to the wrong > region after executing body. No, wait: If BODY inserts or deletes > something inside OR above the region the boundaries of the originally > narrowed region change, don't they? > > This would explain the error: Buffer is narrowed to a region that > happens to end at eob. BODY deletes something inside the region, eob > is decreased by the number of characters deleted. The call to > `narrow-to-region' tries to narrow to a region with an upper boundary > greater than eob -- and that's not possible. > > Solution? Not sure. The function must take into account that BODY > modifies buffer in a way that changes buffer in a way that requires > adjustment of the region boundaries OR even in a way that removes the > part of buffer that contained the region. > > So something like this would fix it: Store markers of beginning and > end of region. IIRC they will move with inserts and deletes. After > executing body narrow to position of these markers if they exist. If > marker for point-max is gone, use eob. If both are gone... Don't > narrow at all? Thanks for the analysis -- now I guess everyone better understand the role of `save-restriction' and `save-excursion'. :) -- Bastien