From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Spiers Subject: FR: more flexible customization of org-agenda-custom-commands key bindings Date: Tue, 16 Oct 2007 17:20:42 +0100 Message-ID: <20071016162042.GC3018@atlantic.linksys.moosehall> Reply-To: Adam Spiers Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ihp9z-0007Fm-CU for emacs-orgmode@gnu.org; Tue, 16 Oct 2007 12:20:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ihp9x-0007FZ-WD for emacs-orgmode@gnu.org; Tue, 16 Oct 2007 12:20:47 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ihp9x-0007FW-Om for emacs-orgmode@gnu.org; Tue, 16 Oct 2007 12:20:45 -0400 Received: from mail.beimborn.com ([70.84.38.100]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ihp9x-0000ov-29 for emacs-orgmode@gnu.org; Tue, 16 Oct 2007 12:20:45 -0400 Received: from mail.beimborn.com (localhost.localdomain [127.0.0.1]) by mail.beimborn.com (8.12.11.20060308/8.12.8) with ESMTP id l9GGKh4h002923 for ; Tue, 16 Oct 2007 11:20:43 -0500 Received: from localhost (localhost [[UNIX: localhost]]) by mail.beimborn.com (8.12.11.20060308/8.12.11/Submit) id l9GGKh28002918 for emacs-orgmode@gnu.org; Tue, 16 Oct 2007 17:20:43 +0100 Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode mailing list 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 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