summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Lundin <mdl@imapmail.org>2010-09-16 10:29:20 +0000
committerCarsten Dominik <carsten.dominik@gmail.com>2010-09-16 17:07:43 +0200
commit8631f55d7193778cf14280e86b4ca4df1b589b29 (patch)
tree7f834f7fae32f8218d12e2f67f94249753d86730
parentd78eba7efbf96ff80cce9f138ec7c2b73cb17207 (diff)
downloadorg-mode-8631f55d7193778cf14280e86b4ca4df1b589b29.tar.gz
Fix bug that erases org buffer when calling agenda via org-agenda-open-link.
[My apologies, but I'm afraid my first attempt at this patch mistook a necessary second check for redundancy. Here is an improved version.] * lisp/org-agenda.el (org-prepare-agenda): If the agenda is called from within the agenda via an elisp link, such as [[elisp:(org-agenda-list)]], org-prepare-agenda erases the buffer of the file containing the link, since that buffer is current during org-prepare agenda (due to a with-current-buffer in org-agenda-open-link). An additional test now ensures that the agenda buffer is in fact current when the buffer is erased and local variables for the agenda are set.
-rw-r--r--lisp/org-agenda.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 194f392..30e8033 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2816,7 +2816,11 @@ the global options and expect it to be applied to the entire view.")
(switch-to-buffer-other-frame abuf))
((equal org-agenda-window-setup 'reorganize-frame)
(delete-other-windows)
- (org-switch-to-buffer-other-window abuf))))
+ (org-switch-to-buffer-other-window abuf)))
+ ;; additional test in case agenda is invoked from within agenda
+ ;; buffer via elisp link
+ (unless (equal (current-buffer) abuf)
+ (switch-to-buffer abuf)))
(setq buffer-read-only nil)
(let ((inhibit-read-only t)) (erase-buffer))
(org-agenda-mode)