emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] New user option for org-agenda-show-and-scroll-up
@ 2014-07-20 18:42 Trevor Murphy
  2014-07-20 18:42 ` [PATCH] org-agenda: Customize agenda-show's drawer hide/show behavior Trevor Murphy
  2014-07-28  9:03 ` [PATCH] New user option for org-agenda-show-and-scroll-up Bastien
  0 siblings, 2 replies; 3+ messages in thread
From: Trevor Murphy @ 2014-07-20 18:42 UTC (permalink / raw)
  To: emacs-orgmode


Hi, all.

The current behavior of `org-agenda-show-and-scroll-up' (SPC from the
Agenda) reveals drawers and logbooks unless the user passes a prefix
argument.  This doesn't work for my flow - I prefer the drawers stay
hidden all the time, unless I prefix the command.

My workflow may be unique to me.  Thus far I've been patching the code
locally.  For fun I'm sharing my patch with the list, in case somebody
else finds it worthwhile.

I've added a defcustom `org-agenda-show-and-scroll-up-show-drawers'.
It defaults to t, and this gives the current behavior.  Customizing it
to nil gives the alternate behavior I prefer.

My not-so-secret hope is that this patch is suitable for applying to
master.  Please let me know if that's the case, or if there are some
changes I can make that would get it there.  I'm fine signing
copyright assignment papers.

Thanks for taking a look!

-- 
Trevor Murphy
GnuPG Key: 0x83881C0A

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] org-agenda: Customize agenda-show's drawer hide/show behavior.
  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
  2014-07-28  9:03 ` [PATCH] New user option for org-agenda-show-and-scroll-up Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Trevor Murphy @ 2014-07-20 18:42 UTC (permalink / raw)
  To: emacs-orgmode

* 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] New user option for org-agenda-show-and-scroll-up
  2014-07-20 18:42 [PATCH] New user option for org-agenda-show-and-scroll-up Trevor Murphy
  2014-07-20 18:42 ` [PATCH] org-agenda: Customize agenda-show's drawer hide/show behavior Trevor Murphy
@ 2014-07-28  9:03 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2014-07-28  9:03 UTC (permalink / raw)
  To: Trevor Murphy; +Cc: emacs-orgmode

Hi Trevor,

Trevor Murphy <trevor.m.murphy@gmail.com> writes:

> I've added a defcustom `org-agenda-show-and-scroll-up-show-drawers'.
> It defaults to t, and this gives the current behavior.  Customizing it
> to nil gives the alternate behavior I prefer.
>
> My not-so-secret hope is that this patch is suitable for applying to
> master.  Please let me know if that's the case, or if there are some
> changes I can make that would get it there.  I'm fine signing
> copyright assignment papers.

The patch is okay for me but yes, you need to go through the copyright
assignment process, as you already have some tiny changes in Org.

http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

Let us know when things are done.

Thanks in advance,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-28 17:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-20 18:42 [PATCH] New user option for org-agenda-show-and-scroll-up Trevor Murphy
2014-07-20 18:42 ` [PATCH] org-agenda: Customize agenda-show's drawer hide/show behavior Trevor Murphy
2014-07-28  9:03 ` [PATCH] New user option for org-agenda-show-and-scroll-up Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).