emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* FR: keystroke to cancel prefix sub-keymap
@ 2007-12-29 21:48 Adam Spiers
  2007-12-31 12:10 ` Adam Spiers
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Spiers @ 2007-12-29 21:48 UTC (permalink / raw)
  To: org-mode mailing list

Suppose that I have a sub-keymap for custom agenda commands with
prefix 's', i.e. shortcuts 's1', 's2', 's3' and so on.  I might invoke
org-agenda, press 's', then change my mind and want to use another
custom command instead.  Currently, the only way of doing this would
be to press something like 'q' or C-g, then reinvoke org-agenda.  It
would be nice instead if there was a keystroke which simply returned
you to the first *Agenda Commands* buffer.  The following patch
demonstrates the required behaviour, but as you can see, is not a
particularly clean way of doing it.

http://www.adamspiers.org/cgi-bin/hg.cgi/org-pacific/rev/8fadf3f7ddda

# HG changeset patch
# User Adam Spiers <orgmode@adamspiers.org>
# Date 1198960339 0
# Node ID 8fadf3f7ddda7680bf0df572bdc48f7a0133ee14
# Parent 42a4c005ba9ce0df46b01b9571fff385a65ccae5
SPACE to cancel prefix sub-keymap

--- a/org.el	Sat Dec 29 20:32:19 2007 +0000
+++ b/org.el	Sat Dec 29 20:32:19 2007 +0000
@@ -19340,6 +19340,14 @@ L   Timeline for current buffer         
 	    (setq restriction nil))
 	   ((and (equal selstring "") (memq c '(?a ?t ?m ?L ?C ?e ?T ?M ?# ?! ?/)))
 	    (throw 'exit (cons (setq selstring (char-to-string c)) restriction)))
+           ((and (> (length selstring) 0) (eq c ? ))
+            (delete-window)
+            (org-agenda-get-restriction-and-command prefix-descriptions))
+;; Can't do it this way because help text describing hardcoded agenda
+;; commands is inserted into buffer outside the (while t ...) loop.
+;;             (setq selstring ""
+;;                   rmheader 0
+;;                   custom org-agenda-custom-commands))
 	   ((equal c ?q) (error "Abort"))
 	   (t (error "Invalid key %c" c))))))))

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

* Re: FR: keystroke to cancel prefix sub-keymap
  2007-12-29 21:48 FR: keystroke to cancel prefix sub-keymap Adam Spiers
@ 2007-12-31 12:10 ` Adam Spiers
  2008-01-03 12:17   ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Spiers @ 2007-12-31 12:10 UTC (permalink / raw)
  To: emacs-orgmode

Adam Spiers (orgmode@adamspiers.org) wrote:
> Suppose that I have a sub-keymap for custom agenda commands with
> prefix 's', i.e. shortcuts 's1', 's2', 's3' and so on.  I might invoke
> org-agenda, press 's', then change my mind and want to use another
> custom command instead.  Currently, the only way of doing this would
> be to press something like 'q' or C-g, then reinvoke org-agenda.  It
> would be nice instead if there was a keystroke which simply returned
> you to the first *Agenda Commands* buffer.  The following patch
> demonstrates the required behaviour, but as you can see, is not a
> particularly clean way of doing it.
> 
> http://www.adamspiers.org/cgi-bin/hg.cgi/org-pacific/rev/8fadf3f7ddda

I forgot to say that the previous patch I posted bound the
cancellation to SPC; however I think DEL would be a more intuitive
choice:

http://www.adamspiers.org/cgi-bin/hg.cgi/org-atlantic/rev/69815deb4483

# HG changeset patch
# User Adam Spiers <orgmode@adamspiers.org>
# Date 1199102771 0
# Node ID 69815deb4483e0e782ec0e164d2058a511243e64
# Parent  518295ce53e0594261d7e1b8d92ab8552c0bd69a
SPACE to cancel prefix sub-keymap

diff -r 518295ce53e0 -r 69815deb4483 org.el
--- a/org.el	Sat Dec 29 20:42:27 2007 +0000
+++ b/org.el	Mon Dec 31 12:06:11 2007 +0000
@@ -19340,6 +19340,14 @@ L   Timeline for current buffer         
 	    (setq restriction nil))
 	   ((and (equal selstring "") (memq c '(?a ?t ?m ?L ?C ?e ?T ?M ?# ?! ?/)))
 	    (throw 'exit (cons (setq selstring (char-to-string c)) restriction)))
+           ((and (> (length selstring) 0) (eq c ?\d))
+            (delete-window)
+            (org-agenda-get-restriction-and-command prefix-descriptions))
+;; Can't do it this way because help text describing hardcoded agenda
+;; commands is inserted into buffer outside the (while t ...) loop.
+;;             (setq selstring ""
+;;                   rmheader 0
+;;                   custom org-agenda-custom-commands))
 	   ((equal c ?q) (error "Abort"))
 	   (t (error "Invalid key %c" c))))))))
 

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

* Re: FR: keystroke to cancel prefix sub-keymap
  2007-12-31 12:10 ` Adam Spiers
@ 2008-01-03 12:17   ` Carsten Dominik
  0 siblings, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2008-01-03 12:17 UTC (permalink / raw)
  To: Adam Spiers; +Cc: emacs-orgmode

I don't have a better solution for now, so I am taking the patch,  
thanks.

- Carsten
On Dec 31, 2007, at 1:10 PM, Adam Spiers wrote:

> Adam Spiers (orgmode@adamspiers.org) wrote:
>> Suppose that I have a sub-keymap for custom agenda commands with
>> prefix 's', i.e. shortcuts 's1', 's2', 's3' and so on.  I might  
>> invoke
>> org-agenda, press 's', then change my mind and want to use another
>> custom command instead.  Currently, the only way of doing this would
>> be to press something like 'q' or C-g, then reinvoke org-agenda.  It
>> would be nice instead if there was a keystroke which simply returned
>> you to the first *Agenda Commands* buffer.  The following patch
>> demonstrates the required behaviour, but as you can see, is not a
>> particularly clean way of doing it.
>>
>> http://www.adamspiers.org/cgi-bin/hg.cgi/org-pacific/rev/8fadf3f7ddda
>
> I forgot to say that the previous patch I posted bound the
> cancellation to SPC; however I think DEL would be a more intuitive
> choice:
>
> http://www.adamspiers.org/cgi-bin/hg.cgi/org-atlantic/rev/69815deb4483
>
> # HG changeset patch
> # User Adam Spiers <orgmode@adamspiers.org>
> # Date 1199102771 0
> # Node ID 69815deb4483e0e782ec0e164d2058a511243e64
> # Parent  518295ce53e0594261d7e1b8d92ab8552c0bd69a
> SPACE to cancel prefix sub-keymap
>
> diff -r 518295ce53e0 -r 69815deb4483 org.el
> --- a/org.el	Sat Dec 29 20:42:27 2007 +0000
> +++ b/org.el	Mon Dec 31 12:06:11 2007 +0000
> @@ -19340,6 +19340,14 @@ L   Timeline for current buffer
> 	    (setq restriction nil))
> 	   ((and (equal selstring "") (memq c '(?a ?t ?m ?L ?C ?e ?T ?M ? 
> # ?! ?/)))
> 	    (throw 'exit (cons (setq selstring (char-to-string c))  
> restriction)))
> +           ((and (> (length selstring) 0) (eq c ?\d))
> +            (delete-window)
> +            (org-agenda-get-restriction-and-command prefix- 
> descriptions))
> +;; Can't do it this way because help text describing hardcoded agenda
> +;; commands is inserted into buffer outside the (while t ...) loop.
> +;;             (setq selstring ""
> +;;                   rmheader 0
> +;;                   custom org-agenda-custom-commands))
> 	   ((equal c ?q) (error "Abort"))
> 	   (t (error "Invalid key %c" c))))))))
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2008-01-03 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-29 21:48 FR: keystroke to cancel prefix sub-keymap Adam Spiers
2007-12-31 12:10 ` Adam Spiers
2008-01-03 12:17   ` Carsten Dominik

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