Browse Source

New hook to preprocess captured data from MobileOrg.

Carsten Dominik 15 years ago
parent
commit
9916ae2b33
2 changed files with 12 additions and 0 deletions
  1. 3 0
      lisp/ChangeLog
  2. 9 0
      lisp/org-mobile.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-11-06  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-mobile.el (org-mobile-before-process-capture-hook): New hook.
+	(org-mobile-pull): Run `org-mobile-before-process-capture-hook'.
+
 	* org.el (org-indent-mode): Define variable already in org.el.
 	(org-unfontify-region): Remove line-prefix and wrap-prefix
 	properties only if org-indent-mode is active.

+ 9 - 0
lisp/org-mobile.el

@@ -252,6 +252,11 @@ create all custom agenda views, for upload to the mobile phone."
 	  (select-window cw)))))
   (message "Files for mobile viewer staged"))
   
+(defvar org-mobile-before-process-capture-hook nil
+  "Hook that is run after content was moved to `org-mobile-inbox-for-pull'.
+The inbox file is in the current buffer, and the buffer is arrowed to the
+new captured data.")
+
 ;;;###autoload
 (defun org-mobile-pull ()
   "Pull the contents of `org-mobile-capture-file' and integrate them.
@@ -263,6 +268,10 @@ agenda view showing the flagged items."
   (let ((insertion-marker (org-mobile-move-capture)))
     (if (not (markerp insertion-marker))
 	(message "No new items")
+      (org-with-point-at insertion-marker
+	(save-restriction
+	  (narrow-to-region (point) (point-max))
+	  (run-hooks 'org-mobile-before-process-capture-hook)))
       (org-with-point-at insertion-marker
 	(org-mobile-apply (point) (point-max)))
       (move-marker insertion-marker nil)