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

david at tethera.net david at tethera.net
Fri Feb 26 04:22:32 PST 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.
---

This is my solution to trying to rationalize the headers of 'm' versus 'r';
now I just call the same hook in both cases. There is actually only 2 lines 
of code added; the rest is a defcustom, docstrings and so on.

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

diff --git a/notmuch.el b/notmuch.el
index 6482170..f47f134 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -471,6 +471,8 @@ buffer."
       (progn
 	(insert "--text follows this line--")
 	(forward-line)))
+  (save-excursion
+    (run-hooks 'notmuch-reply-hook))
   (message-mode))
 
 (defun notmuch-show-reply ()
@@ -1107,6 +1109,14 @@ All currently available key bindings:
   :options '(hl-line-mode)
   :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-show-do-stash (text)
     (kill-new text)
     (message (concat "Saved: " text)))
-- 
1.6.5



More information about the notmuch mailing list