From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Re: Version 7.5: C-c C-t fails with "args out of range" Date: Wed, 09 Mar 2011 06:49:08 +0100 Message-ID: <87sjuw973f.wl%dmaus@ictsoc.de> References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Wed_Mar__9_06:49:08_2011-1"; micalg=pgp-sha256; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=58601 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxCGp-0003B3-Q0 for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 00:49:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxCGo-00008q-D3 for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 00:49:15 -0500 Received: from mail.app1.xlhost.de ([213.202.242.117]:60800 helo=mysql1.xlhost.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxCGo-00007Q-8G for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 00:49:14 -0500 In-Reply-To: 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: Josh Berry Cc: emacs-orgmode@gnu.org --pgp-sign-Multipart_Wed_Mar__9_06:49:08_2011-1 Content-Type: text/plain; charset=US-ASCII At Tue, 8 Mar 2011 15:08:57 -0800, Josh Berry wrote: > > Hi list, > > I just upgraded from org-mode 7.4 to 7.5, and I can't set or change > TODO states at all with C-c C-t now; an args-out-of-range error gets > raised. I've tried doing a "make clean" in my org-mode checkout, to > no avail. > > I'm running GNU emacs 23.2.1 on Mac OSX (in Aqua), installed via > Homebrew. Debugger backtrace is pasted below. > > [[BTW, please forgive me if this isn't a well-formed bug report; I'm > relatively new to Emacs and don't know Elisp. Just let me know if you > need anything else.]] Just a fast comment: Couldn't this be a problem with the macro `org-with-wide-buffer'? #+begin_src emacs-lisp (defmacro org-with-wide-buffer (&rest body) "Execute body while temporarily widening the buffer." `(let ((beg (point-min)) (end (point-max)) (pos (point))) (prog2 (widen) ,@body (narrow-to-region beg end) (goto-char pos)))) #+end_src 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? Best, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de --pgp-sign-Multipart_Wed_Mar__9_06:49:08_2011-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iF4EAREIAAYFAk13FNQACgkQma24O1pEeOac6QEAj0guBHD4c8OzMGpFKJmm54jO JcvkDwSbzfXlc2cEdfcA/Ax6n8L8WgOx6qg88o4lDhK4kGDuynFeXtw+Uc6mnzKu =2nTi -----END PGP SIGNATURE----- --pgp-sign-Multipart_Wed_Mar__9_06:49:08_2011-1--