From c112f40d512e657cd688beb65a2dff6d56c62a21 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 29 Apr 2016 11:35:49 +0200 Subject: [PATCH] org-agenda: Remove unnecessary visibility modification * lisp/org.el (org-show-context-detail): Change default visibility span for agenda context. * lisp/org-agenda.el (org-agenda-goto): (org-agenda-todo): (org-agenda-add-note): (org-agenda-priority): (org-agenda-set-tags): (org-agenda-set-property): (org-agenda-set-effort): (org-agenda-toggle-archive-tag): (org-agenda-clock-in): Special visibility is taken care of by `org-show-context'. Do not hard-code anything else. * contrib/lisp/org-contacts.el (org-contacts-gnus-article-from-goto): Special visibility is taken care of by `org-show-context'. Do not hard-code anything else. --- contrib/lisp/org-contacts.el | 7 +------ lisp/org-agenda.el | 39 +++--------------------------------- lisp/org.el | 3 ++- 3 files changed, 6 insertions(+), 43 deletions(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 1aa2cab8c..13fbf2708 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -675,12 +675,7 @@ description." (when marker (switch-to-buffer-other-window (marker-buffer marker)) (goto-char marker) - (when (eq major-mode 'org-mode) - (org-show-context 'agenda) - (save-excursion - (and (outline-next-heading) - ;; show the next heading - (org-flag-heading nil))))))) + (when (eq major-mode 'org-mode) (org-show-context 'agenda))))) (org-no-warnings (defvar date)) ;; unprefixed, from calendar.el (defun org-contacts-anniversaries (&optional field format) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index d0c5d3bff..85a6ccf36 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -8426,11 +8426,6 @@ When called with a prefix argument, include all archive files as well." (goto-char pos) (when (derived-mode-p 'org-mode) (org-show-context 'agenda) - (save-excursion - (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading - (when (outline-invisible-p) - (outline-show-entry)) ; display invisible text (recenter (/ (window-height) 2)) (org-back-to-heading t) (if (re-search-forward org-complex-heading-regexp nil t) @@ -8873,9 +8868,6 @@ the same tree node, and the headline of the tree node in the Org-mode file." (widen) (goto-char pos) (org-show-context 'agenda) - (save-excursion - (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading (let ((current-prefix-arg arg)) (call-interactively 'org-todo)) (and (bolp) (forward-char 1)) @@ -8914,9 +8906,6 @@ the same tree node, and the headline of the tree node in the Org-mode file." (widen) (goto-char pos) (org-show-context 'agenda) - (save-excursion - (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading (org-add-note)))) (defun org-agenda-change-all-lines (newhead hdmarker @@ -9047,9 +9036,6 @@ Called with a universal prefix arg, show the priority instead of setting it." (widen) (goto-char pos) (org-show-context 'agenda) - (save-excursion - (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading (funcall 'org-priority force-direction) (end-of-line 1) (setq newhead (org-get-heading))) @@ -9073,12 +9059,7 @@ Called with a universal prefix arg, show the priority instead of setting it." (with-current-buffer buffer (widen) (goto-char pos) - (save-excursion - (org-show-context 'agenda)) - (save-excursion - (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading - (goto-char pos) + (org-show-context 'agenda) (if tag (org-toggle-tag tag onoff) (call-interactively 'org-set-tags)) @@ -9101,12 +9082,7 @@ Called with a universal prefix arg, show the priority instead of setting it." (with-current-buffer buffer (widen) (goto-char pos) - (save-excursion - (org-show-context 'agenda)) - (save-excursion - (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading - (goto-char pos) + (org-show-context 'agenda) (call-interactively 'org-set-property))))) (defun org-agenda-set-effort () @@ -9123,12 +9099,7 @@ Called with a universal prefix arg, show the priority instead of setting it." (with-current-buffer buffer (widen) (goto-char pos) - (save-excursion - (org-show-context 'agenda)) - (save-excursion - (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading - (goto-char pos) + (org-show-context 'agenda) (call-interactively 'org-set-effort) (end-of-line 1) (setq newhead (org-get-heading))) @@ -9149,9 +9120,6 @@ Called with a universal prefix arg, show the priority instead of setting it." (widen) (goto-char pos) (org-show-context 'agenda) - (save-excursion - (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading (call-interactively 'org-toggle-archive-tag) (end-of-line 1) (setq newhead (org-get-heading))) @@ -9358,7 +9326,6 @@ ARG is passed through to `org-deadline'." (widen) (goto-char pos) (org-show-context 'agenda) - (org-show-entry) (org-cycle-hide-drawers 'children) (org-clock-in arg) (setq newhead (org-get-heading))) diff --git a/lisp/org.el b/lisp/org.el index f8b5f03a4..dfa80c691 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1151,8 +1151,9 @@ effective." :tag "Org Reveal Location" :group 'org-structure) -(defcustom org-show-context-detail '((isearch . lineage) +(defcustom org-show-context-detail '((agenda . local) (bookmark-jump . lineage) + (isearch . lineage) (default . ancestors)) "Alist between context and visibility span when revealing a location.