* [PATCH v3] Add hook inside notmuch-mua-reply
@ 2023-12-11 22:29 Sandra Snan
2023-12-12 6:44 ` Tomi Ollila
0 siblings, 1 reply; 2+ messages in thread
From: Sandra Snan @ 2023-12-11 22:29 UTC (permalink / raw)
To: notmuch; +Cc: Sandra Snan
This hook is run after `notmuch reply` has been successfully called
with the headers from the original message.
---
emacs/notmuch-mua.el | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index e4b7e9d1..b6c6585d 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -44,13 +44,18 @@
(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
- "Hook run before sending messages."
- :type 'hook
- :group 'notmuch-send
- :group 'notmuch-hooks)
+ (defcustom notmuch-mua-send-hook nil
+ "Hook run before sending messages."
+ :type 'hook
+ :group 'notmuch-send
+ :group 'notmuch-hooks))
(defcustom notmuch-mua-compose-in 'current-window
"Where to create the mail buffer used to compose a new message.
@@ -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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] Add hook inside notmuch-mua-reply
2023-12-11 22:29 [PATCH v3] Add hook inside notmuch-mua-reply Sandra Snan
@ 2023-12-12 6:44 ` Tomi Ollila
0 siblings, 0 replies; 2+ messages in thread
From: Tomi Ollila @ 2023-12-12 6:44 UTC (permalink / raw)
To: Sandra Snan, notmuch
On Mon, Dec 11 2023, Sandra Snan wrote:
> This hook is run after `notmuch reply` has been successfully called
> with the headers from the original message.
> ---
> emacs/notmuch-mua.el | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index e4b7e9d1..b6c6585d 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -44,13 +44,18 @@
> (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
> - "Hook run before sending messages."
> - :type 'hook
> - :group 'notmuch-send
> - :group 'notmuch-hooks)
> + (defcustom notmuch-mua-send-hook nil
> + "Hook run before sending messages."
> + :type 'hook
> + :group 'notmuch-send
> + :group 'notmuch-hooks))
I don't see why this defcustom got indented (viewing context: this diff);
otherwise LGTM.
Tomi
>
> (defcustom notmuch-mua-compose-in 'current-window
> "Where to create the mail buffer used to compose a new message.
> @@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-12 6:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11 22:29 [PATCH v3] Add hook inside notmuch-mua-reply Sandra Snan
2023-12-12 6:44 ` Tomi Ollila
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).