emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Trevor Murphy <trevor.m.murphy@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-agenda: Customize agenda-show's drawer hide/show behavior.
Date: Sun, 20 Jul 2014 14:42:16 -0400	[thread overview]
Message-ID: <1405881736-6299-2-git-send-email-trevor.m.murphy@gmail.com> (raw)
In-Reply-To: <1405881736-6299-1-git-send-email-trevor.m.murphy@gmail.com>

* 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."
+(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.  Reverse this behavior with user option
   (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))
 	  (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)))

  reply	other threads:[~2014-07-20 18:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-20 18:42 [PATCH] New user option for org-agenda-show-and-scroll-up Trevor Murphy
2014-07-20 18:42 ` Trevor Murphy [this message]
2014-07-28  9:03 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405881736-6299-2-git-send-email-trevor.m.murphy@gmail.com \
    --to=trevor.m.murphy@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).