summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2011-03-05 11:01:28 +0100
committerBastien Guerry <bzg@altern.org>2011-03-05 11:01:28 +0100
commit4369d4f9a371db152184860eff27234107af77cd (patch)
treedda19d5583a8fc2fc267457733eb33747118ac5e
parentae8d522a6ca94be487669bdc946c1da0e64f0b0e (diff)
downloadorg-mode-4369d4f9a371db152184860eff27234107af77cd.tar.gz
Bugfix: allow org-blocker-hook to check against headings outside of a narrowed buffer.
* org.el (org-todo): Bugfix: use `org-with-wide-buffer' to check against headings outside of a narrowed buffer. * org-macs.el (org-with-wide-buffer): New macro.
-rw-r--r--lisp/org-macs.el10
-rw-r--r--lisp/org.el5
2 files changed, 12 insertions, 3 deletions
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 2090ca7..13cdbec 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -333,6 +333,15 @@ point nowhere."
(and (markerp (cdr c)) (move-marker (cdr c) nil)))
data)))))
+(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))))
+
(defmacro org-with-limited-levels (&rest body)
"Execute BODY with limited number of outline levels."
`(let* ((outline-regexp (org-get-limited-outline-regexp)))
@@ -344,7 +353,6 @@ point nowhere."
"Return outline-regexp with limited number of levels.
The number of levels is controlled by `org-inlinetask-min-level'"
(if (or (not (org-mode-p)) (not (featurep 'org-inlinetask)))
-
outline-regexp
(let* ((limit-level (1- org-inlinetask-min-level))
(nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
diff --git a/lisp/org.el b/lisp/org.el
index 76f0aa8..7a071f1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10936,8 +10936,9 @@ For calling through lisp, arg is also interpreted in the following way:
(not (member this org-done-keywords)))
(unless (save-excursion
(save-match-data
- (run-hook-with-args-until-failure
- 'org-blocker-hook change-plist)))
+ (org-with-wide-buffer
+ (run-hook-with-args-until-failure
+ 'org-blocker-hook change-plist))))
(if (interactive-p)
(error "TODO state change from %s to %s blocked" this state)
;; fail silently