summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Drieu <bdrieu@april.org>2011-01-25 00:03:48 +0000
committerCarsten Dominik <carsten.dominik@gmail.com>2011-01-25 06:53:35 +0100
commit4cfea25f243b1b60fb86bd11ed07164736635ef4 (patch)
tree2217c28e6b75ed17eb55feeb22c292593ab4becb
parentc78bf704edee3103a094a6057cf32c75c4f521a4 (diff)
downloadorg-mode-4cfea25f243b1b60fb86bd11ed07164736635ef4.tar.gz
New hook for clock selection
* lisp/org-clock.el (org-clock-before-select-task-hook): New hook. (org-clock-select-task): Run new hook. Hi Org-moders, I am often frustrated because I clock a lot of things and some of them are repeated (i.e, coffee, read mails, etc.). So when I want to clock time I spend drinking coffee, the best I found was to search for a headline matching "Coffee". Or to tag frequent clocks and do some agenda research on this tag. Too long. :-) So here is a solution for this need : to add a shortcut property to entries I would like to "bookmark" and insert matching entries in the org-clock-select-task menu. This can be done with : * TODO Pause and drink coffee :PROPERTIES: :SHORTCUT: p :END: then C-u C-c C-x C-i p. And voilą, "Pause and drink coffee" is clocked! Here is a patch that adds a hook into org-clock-select-task and a module that adds the shortcut feature. I tried to be the least intrusive possible, if this proves to be useful, the hook trick might not be needed. Benj TINYCHANGE
-rw-r--r--lisp/org-clock.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 17fccae..8bb67d9 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -388,6 +388,9 @@ of a different task.")
"Return t when clocking a task."
(not (equal (org-clocking-buffer) nil)))
+(defvar org-clock-before-select-task-hook nil
+ "Hook called in task selection just before prompting the user.")
+
(defun org-clock-select-task (&optional prompt)
"Select a task that recently was associated with clocking."
(interactive)
@@ -420,6 +423,7 @@ of a different task.")
(if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s))))
(push s sel-list)))
org-clock-history)
+ (run-hooks 'org-clock-before-select-task-hook)
(org-fit-window-to-buffer)
(message (or prompt "Select task for clocking:"))
(setq rpl (read-char-exclusive))