unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: joshua@joshuao.com
To: notmuch@notmuchmail.org
Cc: Joshua O'Connor <joshua@joshuao.com>
Subject: [PATCH] emacs: add paramter to not quote original message in replies
Date: Sun, 29 May 2022 16:10:40 +0100	[thread overview]
Message-ID: <20220529151040.616780-1-joshua@joshuao.com> (raw)

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

             reply	other threads:[~2022-05-29 17:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-29 15:10 joshua [this message]
2022-05-30 11:58 ` [PATCH] emacs: add paramter to not quote original message in replies Lele Gaifax
2022-06-02 11:49 ` David Bremner

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=20220529151040.616780-1-joshua@joshuao.com \
    --to=joshua@joshuao.com \
    --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).