[PATCH] emacs: add paramter to not quote original message in replies

Subject: [PATCH] emacs: add paramter to not quote original message in replies

Date: Sun, 29 May 2022 16:10:40 +0100

To: notmuch@notmuchmail.org

Cc: Joshua O'Connor

From: joshua@joshuao.com


From: Joshua O'Connor <joshua@joshuao.com>

While the default reply function does nicely set the region to the
quoted text to allow for easy an easy kill-region, at least one
package, org-msg, interprets the incoming citation (or not) and
operates on it. Adding this parameter makes it feasible for users of
that library to write their own notmuch-show-reply-sender-esque
function for this purpose.
---
 emacs/notmuch-mua.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 60801f4b..b37bab0d 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -234,7 +234,7 @@ Typically this is added to `notmuch-mua-send-hook'."
 
 ;;; Mua reply
 
-(defun notmuch-mua-reply (query-string &optional sender reply-all)
+(defun notmuch-mua-reply (query-string &optional sender reply-all omit-original)
   (let ((args '("reply" "--format=sexp" "--format-version=5"))
 	(process-crypto notmuch-show-process-crypto)
 	reply
@@ -280,6 +280,7 @@ Typically this is added to `notmuch-mua-send-hook'."
       (when notmuch-message-replied-tags
 	(setq notmuch-message-queued-tag-changes
 	      (list (cons query-string notmuch-message-replied-tags))))
+      (unless omit-original
       ;; Insert the message body - but put it in front of the signature
       ;; if one is present, and after any other content
       ;; message*setup-hooks may have added to the message body already.
@@ -327,7 +328,7 @@ Typically this is added to `notmuch-mua-send-hook'."
 	(set-mark (point))
 	(goto-char start)
 	;; Quote the original message according to the user's configured style.
-	(funcall notmuch-mua-cite-function)))
+	(funcall notmuch-mua-cite-function))))
     ;; Crypto processing based crypto content of the original message
     (when process-crypto
       (notmuch-mua-reply-crypto (plist-get original :body))))
@@ -512,12 +513,13 @@ the From: address."
       (message-hide-headers)
       (set-buffer-modified-p nil))))
 
-(defun notmuch-mua-new-reply (query-string &optional prompt-for-sender reply-all)
+(defun notmuch-mua-new-reply (query-string &optional prompt-for-sender reply-all omit-original)
   "Compose a reply to the message identified by QUERY-STRING.
 
 If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
 the From: address first.  If REPLY-ALL is non-nil, the message
-will be addressed to all recipients of the source message."
+will be addressed to all recipients of the source message.  If
+OMIT-ORIGINAL is non-nil, the orignial message will not be quoted."
   ;; `select-active-regions' is t by default. The reply insertion code
   ;; sets the region to the quoted message to make it easy to delete
   ;; (kill-region or C-w). These two things combine to put the quoted
@@ -532,7 +534,7 @@ will be addressed to all recipients of the source message."
   (let ((sender (and prompt-for-sender
 		     (notmuch-mua-prompt-for-sender)))
 	(select-active-regions nil))
-    (notmuch-mua-reply query-string sender reply-all)
+    (notmuch-mua-reply query-string sender reply-all omit-original)
     (deactivate-mark)))
 
 ;;; Checks
-- 
2.36.1

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

Thread: