emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] exec code on task state progression


From: David Maus
Subject: Re: [Orgmode] exec code on task state progression
Date: Wed, 01 Sep 2010 07:55:39 +0200
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.2 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Richard Riley wrote:

>What would be the best approach, if at all possible, to having org
>manage tasks which allow me set dates for a task to be scheduled and
>then let me manually progress/cycle that task and have it then invoke
>code/scripts?

Maybe something like this: Store the name of the function to be
executed in a property and define a function which is run in
`org-after-todo-state-change-hook' that reads this property and
executes the function if, say, the state was changed to "DONE".

(defun dmj:execute-func-after-todo-change ()
  "Execute function in exec_func property if entry changes to DONE."
  (when (string= state "DONE")
    (let ((func (intern (org-entry-get nil "exec_func"))))
      (if (fboundp func) (funcall func)))))

(add-hook 'org-after-todo-state-change-hook 'dmj:execute-func-after-todo-change)

For the update part you might want to look at el-get.el[1]:

,----
| Short Story: el-get allows you to install and manage elisp code for
| Emacs. It supports lots of differents types of sources and is able to
| install them, update them and remove them, but more importantly it
| will init them for you.
|
| That means it will care about require ing the features you need, load
| ing the files, setting the Info paths so that C-h i shows the new
| documentation you now depend on, and finally call your own :after
| function for you to setup the extension. Or call it a package.
`----

I did not try it (yet), but this looks sweet.

HTH,
  -- David

[1] http://github.com/dimitri/el-get
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... address@hidden
Email..... address@hidden

Attachment: pgp_LbvavtbEp.pgp
Description: PGP signature


reply via email to

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