Merge org-with-buffer-modified-unmodified' into org-unmodified'

* org.el (org-entry-blocked-p): Use `org-unmodified' instead
of `org-with-buffer-modified-unmodified'.
(org-agenda-prepare-buffers): Fix indentation.

* org-macs.el (org-unmodified): Rename from
`org-with-buffer-modified-unmodified'.
(org-with-buffer-modified-unmodified): Delete.
This commit is contained in:
Bastien Guerry 2013-02-23 11:44:24 +01:00
parent ef1bb160c6
commit 82899fa841
2 changed files with 33 additions and 40 deletions

View file

@ -87,16 +87,6 @@
Otherwise return nil." Otherwise return nil."
(and v (not (equal v "nil")) v)) (and v (not (equal v "nil")) v))
(defmacro org-unmodified (&rest body)
"Execute body without changing `buffer-modified-p'.
Also, do not record undo information."
`(set-buffer-modified-p
(prog1 (buffer-modified-p)
(let ((buffer-undo-list t)
(inhibit-modification-hooks t))
,@body))))
(def-edebug-spec org-unmodified (body))
(defun org-substitute-posix-classes (re) (defun org-substitute-posix-classes (re)
"Substitute posix classes in regular expression RE." "Substitute posix classes in regular expression RE."
(let ((ss re)) (let ((ss re))
@ -127,13 +117,16 @@ Also, do not record undo information."
(def-edebug-spec org-preserve-lc (body)) (def-edebug-spec org-preserve-lc (body))
;; Copied from bookmark.el ;; Copied from bookmark.el
(defmacro org-with-buffer-modified-unmodified (&rest body) (defmacro org-unmodified (&rest body)
"Run BODY while preserving the buffer's `buffer-modified-p' state." "Run BODY while preserving the buffer's `buffer-modified-p' state."
(org-with-gensyms (was-modified) (org-with-gensyms (was-modified)
`(let ((,was-modified (buffer-modified-p))) `(let ((,was-modified (buffer-modified-p)))
(unwind-protect (unwind-protect
(progn ,@body) (let ((buffer-undo-list t)
(set-buffer-modified-p ,was-modified))))) (inhibit-modification-hooks t))
,@body)
(set-buffer-modified-p ,was-modified)))))
(def-edebug-spec org-unmodified (body))
(defmacro org-without-partial-completion (&rest body) (defmacro org-without-partial-completion (&rest body)
`(if (and (boundp 'partial-completion-mode) `(if (and (boundp 'partial-completion-mode)

View file

@ -12157,7 +12157,7 @@ changes because there are unchecked boxes in this entry."
(defun org-entry-blocked-p () (defun org-entry-blocked-p ()
"Is the current entry blocked?" "Is the current entry blocked?"
(org-with-buffer-modified-unmodified (org-unmodified
(if (org-entry-get nil "NOBLOCKING") (if (org-entry-get nil "NOBLOCKING")
nil ;; Never block this entry nil ;; Never block this entry
(not (not
@ -17600,33 +17600,33 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(set-buffer (org-get-agenda-file-buffer file))) (set-buffer (org-get-agenda-file-buffer file)))
(widen) (widen)
(org-unmodified (org-unmodified
(org-refresh-category-properties) (org-refresh-category-properties)
(org-refresh-properties org-effort-property 'org-effort) (org-refresh-properties org-effort-property 'org-effort)
(org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime) (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime)
(setq org-todo-keywords-for-agenda (setq org-todo-keywords-for-agenda
(append org-todo-keywords-for-agenda org-todo-keywords-1)) (append org-todo-keywords-for-agenda org-todo-keywords-1))
(setq org-done-keywords-for-agenda (setq org-done-keywords-for-agenda
(append org-done-keywords-for-agenda org-done-keywords)) (append org-done-keywords-for-agenda org-done-keywords))
(setq org-todo-keyword-alist-for-agenda (setq org-todo-keyword-alist-for-agenda
(append org-todo-keyword-alist-for-agenda org-todo-key-alist)) (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
(setq org-drawers-for-agenda (setq org-drawers-for-agenda
(append org-drawers-for-agenda org-drawers)) (append org-drawers-for-agenda org-drawers))
(setq org-tag-alist-for-agenda (setq org-tag-alist-for-agenda
(append org-tag-alist-for-agenda org-tag-alist)) (append org-tag-alist-for-agenda org-tag-alist))
(save-excursion (save-excursion
(remove-text-properties (point-min) (point-max) pall) (remove-text-properties (point-min) (point-max) pall)
(when org-agenda-skip-archived-trees (when org-agenda-skip-archived-trees
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward rea nil t) (while (re-search-forward rea nil t)
(if (org-at-heading-p t) (if (org-at-heading-p t)
(add-text-properties (point-at-bol) (org-end-of-subtree t) pa)))) (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
(goto-char (point-min)) (goto-char (point-min))
(setq re (format org-heading-keyword-regexp-format (setq re (format org-heading-keyword-regexp-format
org-comment-string)) org-comment-string))
(while (re-search-forward re nil t) (while (re-search-forward re nil t)
(add-text-properties (add-text-properties
(match-beginning 0) (org-end-of-subtree t) pc)))))))) (match-beginning 0) (org-end-of-subtree t) pc))))))))
(setq org-todo-keywords-for-agenda (setq org-todo-keywords-for-agenda
(org-uniquify org-todo-keywords-for-agenda)) (org-uniquify org-todo-keywords-for-agenda))
(setq org-todo-keyword-alist-for-agenda (setq org-todo-keyword-alist-for-agenda