[PATCH v5] Add hook inside notmuch-mua-reply

Subject: [PATCH v5] Add hook inside notmuch-mua-reply

Date: Tue, 12 Dec 2023 13:53:08 +0100

To: notmuch@notmuchmail.org

Cc: Sandra Snan

From: Sandra Snan


This hook is run after `notmuch reply` has been successfully called
with the headers from the original message.
---
Paredit kills me. I accidentally included the following "defcustom"
sexp, someone pointed out the weird indentation, I only unintended it,
sent a patch, and someone else pointed out the way I had included a
sexp too far. What a week.

 emacs/notmuch-mua.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index e4b7e9d1..47390cd4 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -44,6 +44,11 @@
 (defvar notmuch-show-max-text-part-size)
 (defvar notmuch-show-insert-text/plain-hook)
 
+(defvar notmuch-mua-reply-functions nil
+  "Functions to run after `notmuch-reply' was called successfully
+without erroring. The functions get the original message as a
+sexp.")
+
 ;;; Options
 
 (defcustom notmuch-mua-send-hook nil
@@ -256,6 +261,8 @@ Typically this is added to `notmuch-mua-send-hook'."
     ;; Extract the headers of both the reply and the original message.
     (let* ((original-headers (plist-get original :headers))
 	   (reply-headers (plist-get reply :reply-headers)))
+      ;; Run hook here with the original
+      (run-hook-with-args 'notmuch-mua-reply-functions original)
       ;; If sender is non-nil, set the From: header to its value.
       (when sender
 	(plist-put reply-headers :From sender))
-- 
2.39.2

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: