unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: add paramter to not quote original message in replies
@ 2022-05-29 15:10 joshua
  2022-05-30 11:58 ` Lele Gaifax
  2022-06-02 11:49 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: joshua @ 2022-05-29 15:10 UTC (permalink / raw)
  To: notmuch; +Cc: Joshua O'Connor

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: add paramter to not quote original message in replies
  2022-05-29 15:10 [PATCH] emacs: add paramter to not quote original message in replies joshua
@ 2022-05-30 11:58 ` Lele Gaifax
  2022-06-02 11:49 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Lele Gaifax @ 2022-05-30 11:58 UTC (permalink / raw)
  To: notmuch

joshua@joshuao.com writes:

> +will be addressed to all recipients of the source message.  If
> +OMIT-ORIGINAL is non-nil, the orignial message will not be quoted."

s/orignial/original

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.
\r

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: add paramter to not quote original message in replies
  2022-05-29 15:10 [PATCH] emacs: add paramter to not quote original message in replies joshua
  2022-05-30 11:58 ` Lele Gaifax
@ 2022-06-02 11:49 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2022-06-02 11:49 UTC (permalink / raw)
  To: joshua, notmuch; +Cc: Joshua O'Connor

joshua@joshuao.com writes:

> 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.

Since this changes / extends the API, it should have a
test. test/T453-reply.sh has an example you can probably copy and modify
for your purposes. Feel free to use a different message from the
standard corpus.

> ---
>  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

Please do a separate commit with the whitespace cleanup this
requires. Just following the automatic indentation of emacs is most
likely fine (and encouraged).

>        ;; 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."

Please double check the spelling of your changes. There are several typos.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-02 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-29 15:10 [PATCH] emacs: add paramter to not quote original message in replies joshua
2022-05-30 11:58 ` Lele Gaifax
2022-06-02 11:49 ` David Bremner

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).