mercredi, janvier 16 2013

Scheduling appointments with capture template from org-agenda view

I've been frustrated by my inability to schedule appointments directly from the org-agenda view, for quite some time, but I think I've found a way.

If like me you're using org-mode to manage your appointments, you're probably using SCHEDULED TODO items that can be entered in your system using org-capture templates.

A typical scenario is I'm asked by a colleague (face to face or on the phone) when I'm available to schedule a meeting or some other activity. I'm then firing an agenda view, and browse through the dates available... then agreeing on an empty slot, I'm capturing the meeting... but then I have to C-c C-s to add the SCHEDULED marker and set the correct date, although I was previously on that exact date in the org-agenda view :-/

The solution seems to be with the 'k c' command, i.e. the capture org-agenda-action in the agenda view. From the docs :

k runs the command org-agenda-action, which is an interactive compiled
c     Call `org-capture' with cursor date as the default date

Exactly what I need : it will prompt me for a capture template, which I just have to set to a template containing "SCHEDULED: %t".

Excerpt from my .emacs :

'(org-capture-templates (quote (("t" "Todo" entry (file+headline "~/org/" "TACHES") "* TODO %^{Brief description} %^g
    Added: %U
%a") ("n" "Notes" entry (file+datetree "~/org/") "* %^{topic} %T %^g
%a") ("d" "Scheduled appointment" entry (file+headline "~/org/" "TACHES") "* TODO %^{Brief description} %^g

Tadaaa ! it works :-)