emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: David Maus <dmaus@ictsoc.de>
Cc: emacs-orgmode@gnu.org, Josh Berry <des@condordes.net>
Subject: Re: Version 7.5: C-c C-t <anything> fails with "args out of range"
Date: Wed, 09 Mar 2011 10:59:15 +0100	[thread overview]
Message-ID: <87bp1ky5qk.fsf@gnu.org> (raw)
In-Reply-To: <87sjuw973f.wl%dmaus@ictsoc.de> (David Maus's message of "Wed, 09 Mar 2011 06:49:08 +0100")

Hi David,

David Maus <dmaus@ictsoc.de> 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

      parent reply	other threads:[~2011-03-09  9:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 23:08 Version 7.5: C-c C-t <anything> fails with "args out of range" Josh Berry
2011-03-08 23:25 ` Nick Dokos
2011-03-09  0:35   ` Josh Berry
2011-03-09  2:14     ` Nick Dokos
2011-03-09  3:11       ` Josh Berry
2011-03-09  5:49 ` David Maus
2011-03-09  6:55   ` Carsten Dominik
2011-03-09  7:16     ` Josh Berry
2011-03-09  9:57     ` Bastien
2011-03-09  9:59   ` Bastien [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bp1ky5qk.fsf@gnu.org \
    --to=bzg@altern.org \
    --cc=des@condordes.net \
    --cc=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).