emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] FR: more flexible customization of org-agenda-custom-commands


From: Adam Spiers
Subject: [Orgmode] FR: more flexible customization of org-agenda-custom-commands key bindings
Date: Tue, 16 Oct 2007 17:20:42 +0100
User-agent: Mutt/1.5.14 (2007-02-12)

First, apologies for the constant "gimme" nature of my recent
feature-request posts!

org-agenda-custom-commands is awesome in its power.  There are one or
two respects in which I think it could be improved, however.

I make extensive use of the functionality added relatively recently
which enables you to select a tag or TODO keyword with a single
keystroke.  I would now like to build a load of corresponding custom
agenda commands which search for the tag or keyword created with the
same keystroke.  So for example, if I marked a TODO with the :sub60:
tag via C-c C-c 6 <RET> to indicate that I think the task will take
less than 60 minutes to complete, I would also like to be able to
press C-c C-a 6 to search all agenda files for that tag.

This poses no problems in this and most cases.  However, I would like
to have a quick binding for listing priorities:

  C-c C-a A  - to list anything marked [#A]
  C-c C-a B  - to list anything marked [#B]
  C-c C-a C  - to list anything marked [#C]

I copied the elisp using org-agenda-skip-entry-if from John's great
day planner page[1] to achieve these, and it works great.  But it
overwrites the default binding of C-c C-a C which is a handy shortcut
for customizing org-agenda-custom-commands.  So I would like to be
able to move that to another key.  I noticed there is an option to
make a custom agenda command call "Other, user-defined function", but
the relevant bit of org-agenda seems to be:

            ((fboundp type)
                      (org-let lprops '(funcall type match)))

which doesn't allow lambda functions.  If I define my own function: 

  (defun as-test (match)
    (interactive)
    (customize-group 'org-agenda-custom-commands))

and refer to that, it works, but it would be nice if lambdas worked.

Similarly, I would like to bind C-c C-a 1 to search for tasks which
can be done in under 10 minutes (`:sub10:'), and C-c C-a 0 for
something else, but they are hard-bound to limiting the scope of an
imminent search.

It seems to me there are two possible approaches to solve these
binding conflicts.  One would be to move the currently hard-coded
bindings all into org-agenda-custom-commands as default values.  This
would require extending what a custom command can do in some cases, as
witnessed with the lambda issue above.

Another approach, and this is my personal preference, would be to
allow "sub-keymaps", so that e.g. I could press C-c C-a s and it would
present me with a further menu of single keystrokes bound to custom
agenda commands:

   C-c C-a s 1    search for :sub10:  (10 minute tasks)
   C-c C-a s 2    search for :sub120: (2 hour tasks)
   C-c C-a s 3    search for :sub30:  (30 minute tasks)
   C-c C-a s 4    search for :sub40:  (4 hour tasks)

etc.

Not only would this approach make it easier to avoid binding conflicts
with hard-coded bindings, but it also has the advantage of providing
distinct keymaps for different types of searches, e.g. one keymap
could be for searching by GTD context, another by task A/B/C priority,
another by TODO keyword, and so on.

Thoughts?


[1] http://www.newartisans.com/blog_files/org.mode.day.planner.php




reply via email to

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