From fbd138f5270022c42c4e165ed42674b2decf2acc Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 21 Jun 2018 20:13:11 +0200 Subject: [PATCH] org-agenda: Fix SPC in agenda * lisp/org-agenda.el (org-agenda-show-and-scroll-up): Properly display drawers when SPC is pressed. Hide them again with a universal prefix argument. Reported-by: Bernt Hansen --- lisp/org-agenda.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 24b752498..6636a2a43 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -8669,9 +8669,8 @@ if it was hidden in the outline." When called repeatedly, scroll the window that is displaying the buffer. -With a `\\[universal-argument]' prefix, use `org-show-entry' instead of \ -`outline-show-subtree' -to display the item, so that drawers and logbooks stay folded." +With a `\\[universal-argument]' prefix argument, display the item, but \ +fold drawers." (interactive "P") (let ((win (selected-window))) (if (and (window-live-p org-agenda-show-window) @@ -8680,7 +8679,13 @@ to display the item, so that drawers and logbooks stay folded." (select-window org-agenda-show-window) (ignore-errors (scroll-up))) (org-agenda-goto t) - (if arg (org-show-entry) (outline-show-subtree)) + (org-show-entry) + (if arg (org-cycle-hide-drawers 'children) + (org-with-wide-buffer + (narrow-to-region (org-entry-beginning-position) + (org-entry-end-position)) + (org-show-all '(drawers)))) + (when arg ) (setq org-agenda-show-window (selected-window))) (select-window win)))