summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-12-29 09:39:42 +0100
committerBastien Guerry <bzg@altern.org>2012-12-29 09:39:42 +0100
commitaa3786bc20b03cb81f8af4734f367afadb685941 (patch)
tree1db42e1a52ba4a683943ad3028410cc59f64f96a
parentbdbdc4cb2c7f247913e371239117299f1c6820f5 (diff)
downloadorg-mode-aa3786bc20b03cb81f8af4734f367afadb685941.tar.gz
org.el (org-entry-blocked-p): Don't set the buffer as modified
* org.el (org-blocker-hook): Update the docstring to mention that functions in this hook should not modify the buffer. (org-trigger-hook): Small docstring fix. (org-entry-blocked-p): Use `with-buffer-modified-unmodified' so that the function never modifies the buffer. Thanks to Sven Bretfeld for reporting this. When building the agenda, checking for blocked items should not set the buffers as modified, otherwise exiting the agenda will ask for confirmation each time it kills a buffer.
-rw-r--r--lisp/org.el28
1 files changed, 15 insertions, 13 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 14bb0d6..a508cd4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2236,8 +2236,9 @@ Lisp variable `org-state'."
(defvar org-blocker-hook nil
"Hook for functions that are allowed to block a state change.
-Each function gets as its single argument a property list, see
-`org-trigger-hook' for more information about this list.
+Functions in this hook should not modify the buffer.
+Each function gets as its single argument a property list,
+see `org-trigger-hook' for more information about this list.
If any of the functions in this hook returns nil, the state change
is blocked.")
@@ -2245,8 +2246,8 @@ is blocked.")
(defvar org-trigger-hook nil
"Hook for functions that are triggered by a state change.
-Each function gets as its single argument a property list with at least
-the following elements:
+Each function gets as its single argument a property list with at
+least the following elements:
(:type type-of-change :position pos-at-entry-start
:from old-state :to new-state)
@@ -11772,15 +11773,16 @@ changes because there are unchecked boxes in this entry."
(defun org-entry-blocked-p ()
"Is the current entry blocked?"
- (if (org-entry-get nil "NOBLOCKING")
- nil ;; Never block this entry
- (not
- (run-hook-with-args-until-failure
- 'org-blocker-hook
- (list :type 'todo-state-change
- :position (point)
- :from 'todo
- :to 'done)))))
+ (with-buffer-modified-unmodified
+ (if (org-entry-get nil "NOBLOCKING")
+ nil ;; Never block this entry
+ (not
+ (run-hook-with-args-until-failure
+ 'org-blocker-hook
+ (list :type 'todo-state-change
+ :position (point)
+ :from 'todo
+ :to 'done))))))
(defun org-update-statistics-cookies (all)
"Update the statistics cookie, either from TODO or from checkboxes.