emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* exec code on task state progression
@ 2010-08-21  4:10 Richard Riley
  2010-09-01  5:55 ` David Maus
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Riley @ 2010-08-21  4:10 UTC (permalink / raw)
  To: emacs-orgmode


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?

e.g I might have a task which is "Update Org" which is scheduled as a
repeat task once a week, When marking it done for that week (to drop it
from my agenda) it also runs a shell script which goes ahead and
executes a small bash script which does a git pull etc. I might also use
it for, say, reminding me to send an email to certain customers every
month and actually invoke the necessary gnus functions via elisp when I
set it to "done".

I realise I can use babel to manually exec code blocks and that org can
also follow shell and elisp links, but how to easily tie that in with
task flow?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: exec code on task state progression
  2010-08-21  4:10 exec code on task state progression Richard Riley
@ 2010-09-01  5:55 ` David Maus
  0 siblings, 0 replies; 2+ messages in thread
From: David Maus @ 2010-09-01  5:55 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1608 bytes --]

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.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-01  5:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-21  4:10 exec code on task state progression Richard Riley
2010-09-01  5:55 ` David Maus

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).