emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] org-agenda: Customize agenda-show's drawer hide/show behavio


From: Trevor Murphy
Subject: [O] [PATCH] org-agenda: Customize agenda-show's drawer hide/show behavior.
Date: Sun, 20 Jul 2014 14:42:16 -0400

* lisp/org-agenda.el (org-agenda-show-and-scroll-up-show-drawers): New
  user option.  Controls whether `org-agenda-show-and-scroll-up' hides
  or shows drawers without a prefix arg.  Pre-patch behavior
  corresponds to setting this to t (the default).
* lisp/org-agenda.el (org-agenda-show-and-scroll-up): Compute
  hide/show behavior based on user option and prefix arg.
---
 lisp/org-agenda.el | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f24e1f6..e556a4a 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -135,6 +135,14 @@ addresses the separator between the current and the 
previous block."
          (character)
          (string)))
 
+(defcustom org-agenda-show-and-scroll-up-show-drawers t
+  "Non-nil means show drawers by default when displaying the item at point.
+Set this to nil to reverse the behavior of
+`org-agenda-show-and-scroll-up' with respect to a
+\\[universal-argument] prefix."
+  :group 'org-agenda
+  :type 'boolean)
+
 (defgroup org-agenda-export nil
   "Options concerning exporting agenda views in Org-mode."
   :tag "Org Agenda Export"
@@ -8603,16 +8611,20 @@ 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
 `show-subtree' to display the item, so that drawers and logbooks stay
-folded."
+folded.  Reverse this behavior with user option
+`org-agenda-show-and-scroll-up-show-drawers'."
   (interactive "P")
-  (let ((win (selected-window)))
+  (let ((win (selected-window))
+        (fold (if org-agenda-show-and-scroll-up-show-drawers
+                  arg
+                (not arg))))
     (if (and (window-live-p org-agenda-show-window)
             (eq this-command last-command))
        (progn
          (select-window org-agenda-show-window)
          (ignore-errors (scroll-up)))
       (org-agenda-goto t)
-      (if arg (org-show-entry) (show-subtree))
+      (if fold (org-show-entry) (show-subtree))
       (setq org-agenda-show-window (selected-window)))
     (select-window win)))
 
-- 
2.0.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]