From mboxrd@z Thu Jan 1 00:00:00 1970 From: Trevor Murphy Subject: [PATCH] org-agenda: Customize agenda-show's drawer hide/show behavior. Date: Sun, 20 Jul 2014 14:42:16 -0400 Message-ID: <1405881736-6299-2-git-send-email-trevor.m.murphy@gmail.com> References: <1405881736-6299-1-git-send-email-trevor.m.murphy@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8w4A-000314-Nq for emacs-orgmode@gnu.org; Sun, 20 Jul 2014 14:42:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X8w3z-00065G-2h for emacs-orgmode@gnu.org; Sun, 20 Jul 2014 14:42:34 -0400 Received: from mail-yk0-x22f.google.com ([2607:f8b0:4002:c07::22f]:50710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8w3y-00065A-UY for emacs-orgmode@gnu.org; Sun, 20 Jul 2014 14:42:23 -0400 Received: by mail-yk0-f175.google.com with SMTP id q200so3297644ykb.20 for ; Sun, 20 Jul 2014 11:42:22 -0700 (PDT) Received: from localhost.localdomain (z65-50-91-81.ips.direcpath.com. [65.50.91.81]) by mx.google.com with ESMTPSA id v43sm23548975yhj.18.2014.07.20.11.42.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 20 Jul 2014 11:42:21 -0700 (PDT) In-Reply-To: <1405881736-6299-1-git-send-email-trevor.m.murphy@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * 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