Re: [O] Version 7.5: C-c C-t anything fails with args out of range
Hi Carsten, Carsten Dominik carsten.domi...@gmail.com writes: (defmacro org-with-wide-buffer (rest body) Execute body while temporarily widening the buffer. `(save-excursion (save-restriction (widen) ,@body))) Err... of course. Stupid me. Thanks for looking into this and for the fix -- applied now. Best, -- Bastien
Re: [O] Version 7.5: C-c C-t anything fails with args out of range
Hi David, David Maus dm...@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
[O] Version 7.5: C-c C-t anything fails with args out of range
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.]] -- Debugger entered--Lisp error: (args-out-of-range 1 4913) narrow-to-region(1 4913) (prog2 (widen) (run-hook-with-args-until-failure (quote org-blocker-hook) change-plist) (narrow-to-region beg end) (goto-char pos)) (let ((beg ...) (end ...) (pos ...)) (prog2 (widen) (run-hook-with-args-until-failure ... change-plist) (narrow-to-region beg end) (goto-char pos))) (org-with-wide-buffer (run-hook-with-args-until-failure (quote org-blocker-hook) change-plist)) (progn (org-with-wide-buffer (run-hook-with-args-until-failure ... change-plist))) (unwind-protect (progn (org-with-wide-buffer ...)) (set-match-data save-match-data-internal (quote evaporate))) (let ((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...))) (save-match-data (org-with-wide-buffer (run-hook-with-args-until-failure ... change-plist))) (save-excursion (save-match-data (org-with-wide-buffer ...))) (if (save-excursion (save-match-data ...)) nil (if (interactive-p) (error TODO state change from %s to %s blocked this state) (message TODO state change from %s to %s blocked this state) (throw ... nil))) (unless (save-excursion (save-match-data ...)) (if (interactive-p) (error TODO state change from %s to %s blocked this state) (message TODO state change from %s to %s blocked this state) (throw ... nil))) (progn (setq org-last-todo-state-is-todo (not ...)) (unless (save-excursion ...) (if ... ... ... ...))) (if org-blocker-hook (progn (setq org-last-todo-state-is-todo ...) (unless ... ...))) (when org-blocker-hook (setq org-last-todo-state-is-todo (not ...)) (unless (save-excursion ...) (if ... ... ... ...))) (let* ((match-data ...) (startpos ...) (logging ...) (org-log-done org-log-done) (org-log-repeat org-log-repeat) (org-todo-log-states org-todo-log-states) (this ...) (hl-pos ...) (head ...) (ass ...) (interpret ...) (done-word ...) (final-done-word ...) (last-state ...) (completion-ignore-case t) (member ...) (tail ...) (state ...) (state ...) (next ...) (change-plist ...) dolog now-done-p) (when org-blocker-hook (setq org-last-todo-state-is-todo ...) (unless ... ...)) (store-match-data match-data) (replace-match next t t) (unless (pos-visible-in-window-p hl-pos) (message TODO state changed to %s ...)) (unless head (setq head ... ass ... interpret ... done-word ... final-done-word ...)) (when (memq arg ...) (message Keyword-Set %d/%d: %s ... ... ...)) (setq org-last-todo-state-is-todo (not ...)) (setq now-done-p (and ... ...)) (and logging (org-local-logging logging)) (when (and ... ... ...) (setq dolog ...) (if ... ...) (when ... ...) (when ... ... ...) (when ... ...)) (org-todo-trigger-tag-changes state) (and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t)) (when org-provide-todo-statistics (org-update-parent-todo-statistics)) (run-hooks (quote org-after-todo-state-change-hook)) (if (and arg ...) (setq head ...)) (put-text-property (point-at-bol) (point-at-eol) (quote org-todo-head) head) (when now-done-p (when ... ...) (org-auto-repeat-maybe state)) (if (and ... ... ... ...) (progn ... ...)) (when org-trigger-hook (save-excursion ...))) (catch (quote exit) (org-back-to-heading t) (if (looking-at outline-regexp) (goto-char ...)) (or (looking-at ...) (looking-at *)) (let* (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... dolog now-done-p) (when org-blocker-hook ... ...) (store-match-data match-data) (replace-match next t t) (unless ... ...) (unless head ...) (when ... ...) (setq org-last-todo-state-is-todo ...) (setq now-done-p ...) (and logging ...) (when ... ... ... ... ... ...) (org-todo-trigger-tag-changes state) (and org-auto-align-tags ... ...) (when org-provide-todo-statistics ...) (run-hooks ...) (if ... ...) (put-text-property ... ... ... head) (when now-done-p ... ...) (if ... ...) (when org-trigger-hook ...))) (save-excursion (catch (quote exit) (org-back-to-heading t) (if ... ...) (or ... ...) (let* ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...))) (let ((org-blocker-hook org-blocker-hook) (case-fold-search nil)) (when (equal arg ...) (setq arg nil org-blocker-hook nil)) (when (and org-blocker-hook ...) (setq org-blocker-hook nil)) (save-excursion (catch ... ... ... ... ...))) org-todo(nil) call-interactively(org-todo nil nil) -- Can you please advise me on what (if anything) I should do next? Thanks in advance for your help! -- Josh
Re: [O] Version 7.5: C-c C-t anything fails with args out of range
Josh Berry d...@condordes.net wrote: 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.]] -- Debugger entered--Lisp error: (args-out-of-range 1 4913) narrow-to-region(1 4913) (prog2 (widen) (run-hook-with-args-until-failure (quote org-blocker-hook) change-plist) (narrow-to-region beg end) (goto-char pos)) (let ((beg ...) (end ...) (pos ...)) (prog2 (widen) (run-hook-with-args-until-failure ... change-plist) (narrow-to-region beg end) (goto-char pos))) (org-with-wide-buffer (run-hook-with-args-until-failure (quote org-blocker-hook) change-plist)) ... Can you please advise me on what (if anything) I should do next? Thanks in advance for your help! See the thread http://thread.gmane.org/gmane.emacs.orgmode/38966 It seems all you have to do is git pull; make clean; make and restart your emacs. Nick
Re: [O] Version 7.5: C-c C-t anything fails with args out of range
On Tue, Mar 8, 2011 at 15:25, Nick Dokos nicholas.do...@hp.com wrote: Josh Berry d...@condordes.net wrote: 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. ... Can you please advise me on what (if anything) I should do next? Thanks in advance for your help! See the thread http://thread.gmane.org/gmane.emacs.orgmode/38966 It seems all you have to do is git pull; make clean; make and restart your emacs. Unfortunately this doesn't help. I did as you suggested -- switched back to master, then did git pull; make clean; make all, and I can still reproduce the problem. I'm on commit 4090006ab124dd10698f21f1ee44c913b5faf990. Thanks, Josh
Re: [O] Version 7.5: C-c C-t anything fails with args out of range
Josh Berry d...@condordes.net wrote: On Tue, Mar 8, 2011 at 15:25, Nick Dokos nicholas.do...@hp.com wrote: Josh Berry d...@condordes.net wrote: 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. =C2=A0I've tried doing a make clean in my org-mode checkout, t= o no avail. ... Can you please advise me on what (if anything) I should do next? Thanks in advance for your help! See the thread =C2=A0 =C2=A0http://thread.gmane.org/gmane.emacs.orgmode/38966 It seems all you have to do is git pull; make clean; make and restart your emacs. Unfortunately this doesn't help. I did as you suggested -- switched back to master, then did git pull; make clean; make all, and I can still reproduce the problem. ... and did you restart your emacs? Nick
Re: [O] Version 7.5: C-c C-t anything fails with args out of range
On Tue, Mar 8, 2011 at 18:14, Nick Dokos nicholas.do...@hp.com wrote: Josh Berry d...@condordes.net wrote: On Tue, Mar 8, 2011 at 15:25, Nick Dokos nicholas.do...@hp.com wrote: Josh Berry d...@condordes.net wrote: 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. =C2=A0I've tried doing a make clean in my org-mode checkout, t= o no avail. ... Can you please advise me on what (if anything) I should do next? Thanks in advance for your help! See the thread =C2=A0 =C2=A0http://thread.gmane.org/gmane.emacs.orgmode/38966 It seems all you have to do is git pull; make clean; make and restart your emacs. Unfortunately this doesn't help. I did as you suggested -- switched back to master, then did git pull; make clean; make all, and I can still reproduce the problem. ... and did you restart your emacs? Yes. :P :) -- Josh
Re: [O] Version 7.5: C-c C-t anything fails with args out of range
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 dmj...@jabber.org Email. dm...@ictsoc.de pgp9RBVX42CDK.pgp Description: PGP signature
Re: [O] Version 7.5: C-c C-t anything fails with args out of range
On 9.3.2011, at 06:49, David Maus wrote: 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 This macro is indeed not written in a stable way and will fail of the buffer gets modified with @body. But Emacs already has save-restriction, so there is no need to re-invent the wheel: (defmacro org-with-wide-buffer (rest body) Execute body while temporarily widening the buffer. `(save-excursion (save-restriction (widen) ,@body))) Cheers - Carsten 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 dmj...@jabber.org Email. dm...@ictsoc.de
Re: [O] Version 7.5: C-c C-t anything fails with args out of range
On Tue, Mar 8, 2011 at 22:55, Carsten Dominik carsten.domi...@gmail.com wrote: On 9.3.2011, at 06:49, David Maus wrote: 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 This macro is indeed not written in a stable way and will fail of the buffer gets modified with @body. But Emacs already has save-restriction, so there is no need to re-invent the wheel: (defmacro org-with-wide-buffer (rest body) Execute body while temporarily widening the buffer. `(save-excursion (save-restriction (widen) ,@body))) I just hacked your version of org-with-wide-buffer into my org-macs.el file, and it appears to fix the problem. Thanks! -- Josh