summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernt Hansen <bernt@norang.ca>2011-12-30 05:49:09 -0500
committerBastien Guerry <bzg@altern.org>2012-01-11 16:42:35 +0100
commit8f93a75cacbfffb120d5ce18c494e2b85afa8d74 (patch)
treedf82d7bbcb6b96595189852ee396854cf257426b
parentc41a6f5a333441ba68029c6f8792c9a9938fc57c (diff)
downloadorg-mode-8f93a75cacbfffb120d5ce18c494e2b85afa8d74.tar.gz
Honour existing restrictions when visiting tasks from the agenda
* lisp/org-agenda.el (org-agenda-switch-to): Widen org buffer only if point is outside the current restriction Widen org buffer when visiting from agenda only if point is outside current restriction. Visiting a task with RET or TAB in the agenda should not affect the org-mode buffer restriction unless the target task is not currently visible due to the restriction.
-rw-r--r--lisp/org-agenda.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index e45ee14..8927b61 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7113,7 +7113,9 @@ at the text of the entry itself."
(pos (marker-position marker)))
(org-pop-to-buffer-same-window buffer)
(and delete-other-windows (delete-other-windows))
- (widen)
+ (when (or (< pos (point-min))
+ (> pos (point-max)))
+ (widen))
(goto-char pos)
(when (eq major-mode 'org-mode)
(org-show-context 'agenda)