New macro `org-with-buffer-modified-unmodified'
authorBastien Guerry <bzg@altern.org>
Sun, 30 Dec 2012 00:21:27 +0000 (30 01:21 +0100)
committerBastien Guerry <bzg@altern.org>
Sun, 30 Dec 2012 00:21:27 +0000 (30 01:21 +0100)
* org-macs.el (org-with-buffer-modified-unmodified): New
macro.

* org.el (org-entry-blocked-p): Use the new macro.

Thanks to Nick Dokos for reporting this.

The macro is a copy of `with-buffer-modified-unmodified'
which (wrongly?) lives in bookmark.el.

lisp/org-macs.el
lisp/org.el

index e999917..a5d0c62 100644 (file)
@@ -126,6 +126,15 @@ Also, do not record undo information."
         (org-move-to-column ,col)))))
 (def-edebug-spec org-preserve-lc (body))
 
+;; Copied from bookmark.el
+(defmacro org-with-buffer-modified-unmodified (&rest body)
+  "Run BODY while preserving the buffer's `buffer-modified-p' state."
+  (org-with-gensyms (was-modified)
+    `(let ((,was-modified (buffer-modified-p)))
+       (unwind-protect
+           (progn ,@body)
+         (set-buffer-modified-p ,was-modified)))))
+
 (defmacro org-without-partial-completion (&rest body)
   `(if (and (boundp 'partial-completion-mode)
            partial-completion-mode
index a508cd4..b06b0ac 100644 (file)
@@ -11773,7 +11773,7 @@ changes because there are unchecked boxes in this entry."
 
 (defun org-entry-blocked-p ()
   "Is the current entry blocked?"
-  (with-buffer-modified-unmodified
+  (org-with-buffer-modified-unmodified
    (if (org-entry-get nil "NOBLOCKING")
        nil ;; Never block this entry
      (not