emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Benjamin Drieu <bdrieu@april.org>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Add shortcuts to org-clock-select-task
Date: Mon, 24 Jan 2011 20:03:48 +0100	[thread overview]
Message-ID: <87hbcynmy3.fsf@home.drieu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]


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

-- 
* Benjamin Drieu <bdrieu@april.org> - http://www.april.org/
* Soutenez le logiciel libre, rejoignez l'April
  http://www.april.org/association/campagne-adhesion/
* La comptabilité personnelle libre pour tous - http://grisbi.org/

[-- Attachment #2: org-shortcuts.el --]
[-- Type: application/emacs-lisp, Size: 2848 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3.1: org-shortcuts.patch --]
[-- Type: text/x-patch, Size: 472 bytes --]

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 17fccae..8f2f353 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -420,6 +420,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-select-task-hook)
       (org-fit-window-to-buffer)
       (message (or prompt "Select task for clocking:"))
       (setq rpl (read-char-exclusive))

[-- Attachment #3.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2011-01-24 19:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 19:03 Benjamin Drieu [this message]
2011-01-25  5:55 ` [PATCH] Add shortcuts to org-clock-select-task Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hbcynmy3.fsf@home.drieu.org \
    --to=bdrieu@april.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).