forked from mirrors/org-mode
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.
This commit is contained in:
parent
ae8d522a6c
commit
4369d4f9a3
|
@ -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)))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue