summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-12-19 18:46:15 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-12-19 18:46:15 -0700
commit61470f6ae1193181722685fdff882b2400ba942a (patch)
treec33a87ef16cac88a47507877d65ec9d1da1375c8
parent76661a853aff0a26414410a56e78924ef1103060 (diff)
downloadorg-mode-61470f6ae1193181722685fdff882b2400ba942a.tar.gz
org-mime: hooks run in org-mode buffer when composing an email
Thanks to Ethan Ligon for suggesting this functionality. An example hook such as the following will record when emails have been composed (add-hook 'org-mime-send-subtree-hook (lambda () (org-entry-put (point) "mail_composed" (current-time-string)))) * contrib/lisp/org-mime.el (org-mime-send-subtree-hook): Hooks run in the org-mode subtree when composing an email. (org-mime-send-buffer-hook): Hooks run in the org-mode buffer when composing an email.
-rw-r--r--contrib/lisp/org-mime.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el
index 9b369e6..d8cae9e 100644
--- a/contrib/lisp/org-mime.el
+++ b/contrib/lisp/org-mime.el
@@ -94,6 +94,12 @@
"buffer holding\nthe text to be exported."))))
'("ascii" "org" "html" "html-ascii"))
+(defcustom org-mime-send-subtree-hook nil
+ "Hook to run in the subtree in the Org-mode file before export.")
+
+(defcustom org-mime-send-buffer-hook nil
+ "Hook to run in the Org-mode file before export.")
+
;; example hook, for setting a dark background in <pre style="background-color: #EEE;"> elements
(defun org-mime-change-element-style (element style)
"Set new default htlm style for <ELEMENT> elements in exported html."
@@ -223,6 +229,7 @@ export that region, otherwise export the entire body."
(defun org-mime-send-subtree (&optional fmt)
(save-restriction
(org-narrow-to-subtree)
+ (run-hooks 'org-mime-send-subtree-hook)
(let* ((file (buffer-file-name (current-buffer)))
(subject (nth 4 (org-heading-components)))
(to (org-entry-get nil "MAIL_TO"))
@@ -240,6 +247,7 @@ export that region, otherwise export the entire body."
`((cc . ,cc) (bcc . ,bcc))))))
(defun org-mime-send-buffer (&optional fmt)
+ (run-hooks 'org-mime-send-buffer-hook)
(let* ((region-p (org-region-active-p))
(subject (org-export-grab-title-from-buffer))
(file (buffer-file-name (current-buffer)))