[PATCH v2] notmuch.el: add a hook to notmuch-reply

David Bremner david at tethera.net
Wed Apr 21 14:41:35 PDT 2010


From: David Bremner <bremner at unb.ca>

This patch introduces a variable notmuch-reply-hook and calls it using
run-hooks. This allows people to easily override the header setup and
so forth done by notmuch-reply.  In particular it allows harmonizing
the headers of message-mode and notmuch-reply.
---

Rebased against current master. The rework was inspired by current
discussion about how Bcc handling was broken in message-mode buffers
not generated by notmuch-reply.

 emacs/notmuch.el |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 66958a6..563fdc8 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -72,6 +72,14 @@ For example:
   :type '(alist :key-type (string) :value-type (string))
   :group 'notmuch)
 
+(defcustom notmuch-reply-hook nil
+  "List of functions to call when replying to a message.
+Run after the buffer content is returned from notmuch and before
+handing off to message mode. The function `notmuch-reply' runs
+this hook."
+  :type 'hook
+  :group 'notmuch)
+
 (defun notmuch-select-tag-with-completion (prompt &rest search-terms)
   (let ((tag-list
 	 (with-output-to-string
@@ -124,6 +132,8 @@ For example:
       (progn
 	(insert "--text follows this line--")
 	(forward-line)))
+  (save-excursion
+    (run-hooks 'notmuch-reply-hook))
   (message-mode))
 
 (defun notmuch-documentation-first-line (symbol)
-- 
1.7.0



More information about the notmuch mailing list