summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-04-10 14:32:24 +0200
committerBastien Guerry <bzg@altern.org>2013-04-10 14:32:24 +0200
commit08a47b0959fbed935b73eeda8a92c88905a2e5b5 (patch)
tree2d1badd6cb3e58fe22ecd55951601c68e0f10e5b
parente2843e5fd78cad66895353f21fab58b1f34ba33e (diff)
downloadorg-mode-08a47b0959fbed935b73eeda8a92c88905a2e5b5.tar.gz
org.el (org-store-log-note): Fix `buffer-undo-list' when called after `org-agenda-todo'
* org.el (org-store-log-note): Fix `buffer-undo-list' when called after `org-agenda-todo'. Thanks to Wanrong Lin for reporting this obscure bug.
-rw-r--r--lisp/org.el19
1 files changed, 13 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 36f7c17..2cbab66 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13342,12 +13342,19 @@ EXTRA is additional text that will be inserted into the notes buffer."
(insert (pop lines))))
(message "Note stored")
(org-back-to-heading t)
- (org-cycle-hide-drawers 'children))))))
- (set-window-configuration org-log-note-window-configuration)
- (with-current-buffer (marker-buffer org-log-note-return-to)
- (goto-char org-log-note-return-to))
- (move-marker org-log-note-return-to nil)
- (and org-log-post-message (message "%s" org-log-post-message)))
+ (org-cycle-hide-drawers 'children))
+ ;; Fix `buffer-undo-list' when `org-store-log-note' is called
+ ;; from within `org-add-log-note' because `buffer-undo-list'
+ ;; is then modified outside of `org-with-remote-undo'.
+ (when (eq this-command 'org-agenda-todo)
+ (setcdr buffer-undo-list (cddr buffer-undo-list)))))))
+ ;; Don't add undo information when called from `org-agenda-todo'
+ (let ((buffer-undo-list (eq this-command 'org-agenda-todo)))
+ (set-window-configuration org-log-note-window-configuration)
+ (with-current-buffer (marker-buffer org-log-note-return-to)
+ (goto-char org-log-note-return-to))
+ (move-marker org-log-note-return-to nil)
+ (and org-log-post-message (message "%s" org-log-post-message))))
(defun org-remove-empty-drawer-at (drawer pos)
"Remove an empty drawer DRAWER at position POS.