Hi,

in order to allow custom processes to be run whenever a planner
project is published, I'd like planner to run a hook right after
publishing. The following patch does the following:

- captures the C-c C-p keystroke from muse
- defines a new function planner-publish-project. This is a thin
  wrapper around the muse publishing function which runs a new hook
  planner-publish-hook

Other code may now use this hook to run whatever is appropriate after
publishing a planner project.

regards,
Markus

--- planner.el.orig     Wed Nov 28 22:10:41 2007
+++ planner.el  Wed Nov 28 22:37:56 2007
@@ -673,6 +673,8 @@
     (define-key map "\C-c\C-z" 'planner-task-in-progress)
     (define-key map "\C-c\C-x" 'planner-task-done)
     (define-key map '[(control ?c) (control ?X)] 'planner-task-cancelled)
+    ;; capture the publishing keystrokes from muse
+    (define-key map "\C-c\C-p" 'planner-publish-project)
     map)
   "Keymap used by Planner mode.")
 
@@ -727,6 +729,19 @@
     (define-key map "\C-c\C-o\C-s" 'planner-search-notes)
     (define-key map "\C-c\C-o\C-b" 'planner-search-notes-with-body)
     (define-key map "\C-c\C-o\C-n" 'planner-renumber-notes)))
+
+(defvar planner-publish-hook nil
+  "A hook to be run after a planner project has been published")
+
+;; this function hands the publishing chores straight to muse but runs
+;; a hook when muse is done. This allows to perform additional
+;; planner-specific tasks whenever a planner project is published.
+(defun planner-publish-project ()
+  "Publish the project and run a planner-publishing specific hook."
+  (interactive)
+  (muse-project-publish nil)
+  (run-hooks 'planner-publish-hook)
+  (message "Planner has finished publishing"))
 
 ;;;_* Menu
 

-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de


_______________________________________________
Planner-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/planner-el-discuss

Reply via email to