unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Sandra Snan <sandra.snan@idiomdrottning.org>
To: notmuch@notmuchmail.org
Cc: Sandra Snan <sandra.snan@idiomdrottning.org>
Subject: [PATCH v2] Add hook inside notmuch-mua-reply
Date: Mon, 11 Dec 2023 22:04:21 +0100	[thread overview]
Message-ID: <20231211210421.1716248-1-sandra.snan@idiomdrottning.org> (raw)

This hook is run after `notmuch reply` has been successfully called
with the headers from the original message.
---
 emacs/notmuch-mua.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index e4b7e9d1..08d3dd6d 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 in-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 'in-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

                 reply	other threads:[~2023-12-11 21:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231211210421.1716248-1-sandra.snan@idiomdrottning.org \
    --to=sandra.snan@idiomdrottning.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).