From: Bastien Guerry Date: Sun, 30 Dec 2012 00:21:27 +0000 (+0100) Subject: New macro `org-with-buffer-modified-unmodified' X-Git-Tag: release_7.9.3~52 X-Git-Url: https://repo.or.cz/w/org-mode.git/commitdiff_plain/14c3635a0dc532401ba3aa9a5b5c2650bc562b40 New macro `org-with-buffer-modified-unmodified' * 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. --- diff --git a/lisp/org-macs.el b/lisp/org-macs.el index e99991702..a5d0c62ea 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -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 diff --git a/lisp/org.el b/lisp/org.el index a508cd4b4..b06b0ac2a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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