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.
This commit is contained in:
Bernt Hansen 2011-12-30 15:49:09 +00:00 committed by Carsten Dominik
parent fc1f01c54e
commit 31d003ad28
1 changed files with 3 additions and 1 deletions

View File

@ -7033,7 +7033,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)