unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Add References header to forwarded messages
@ 2019-03-29 12:01 ekeberg
  2019-03-31 23:32 ` Daniel Kahn Gillmor
  0 siblings, 1 reply; 3+ messages in thread
From: ekeberg @ 2019-03-29 12:01 UTC (permalink / raw)
  To: notmuch

From: Örjan Ekeberg <ekeberg@kth.se>

Include the message-id of forwarded messages in the new message.
This ensures that the new (forwarding) message is linked to the
same thread as the message being forwarded.
---
 emacs/notmuch-mua.el | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 708db248..ed15bbb2 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -470,8 +470,9 @@ the From: address."
   (let* ((other-headers
 	  (when (or prompt-for-sender notmuch-always-prompt-for-sender)
 	    (list (cons 'From (notmuch-mua-prompt-for-sender)))))
-	 forward-subject) ;; Comes from the first message and is
+	 forward-subject  ;; Comes from the first message and is
 			  ;; applied later.
+	 forward-references) ;; Accumulated message-ids of forwarded messages
 
     ;; Generate the template for the outgoing message.
     (notmuch-mua-mail nil "" other-headers nil (notmuch-mua-get-switch-function))
@@ -489,7 +490,12 @@ the From: address."
 		  ;; Because we process the messages in reverse order,
 		  ;; always generate a forwarded subject, then use the
 		  ;; last (i.e. first) one.
-		  (setq forward-subject (message-make-forward-subject)))
+		  (setq forward-subject (message-make-forward-subject))
+		  (if forward-references
+		      (setq forward-references
+			    (concat forward-references ", "
+				    (message-fetch-field "Message-ID")))
+		    (setq forward-references (message-fetch-field "Message-ID"))))
 		;; Make a copy ready to be forwarded in the
 		;; composition buffer.
 		(message-forward-make-body temp-buffer)
@@ -503,7 +509,9 @@ the From: address."
       (save-restriction
 	(message-narrow-to-headers)
 	(message-remove-header "Subject")
-	(message-add-header (concat "Subject: " forward-subject)))
+	(message-add-header (concat "Subject: " forward-subject))
+	(message-remove-header "References")
+	(message-add-header (concat "References: " forward-references)))
 
       ;; `message-forward-make-body' shows the User-agent header.  Hide
       ;; it again.
-- 
2.20.1

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

* Re: [PATCH] emacs: Add References header to forwarded messages
  2019-03-29 12:01 [PATCH] emacs: Add References header to forwarded messages ekeberg
@ 2019-03-31 23:32 ` Daniel Kahn Gillmor
  2019-04-01 13:23   ` Örjan Ekeberg
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Kahn Gillmor @ 2019-03-31 23:32 UTC (permalink / raw)
  To: ekeberg, notmuch

On Fri 2019-03-29 13:01:09 +0100,  Örjan Ekeberg <ekeberg@kth.se> wrote:

> Include the message-id of forwarded messages in the new message.
> This ensures that the new (forwarding) message is linked to the
> same thread as the message being forwarded.

This seems reasonable to me.  I'd personally like forwarded messages to
show up connected to the same thread os the originals, and i don't see a
downside to it.

     --dkg

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

* Re: [PATCH] emacs: Add References header to forwarded messages
  2019-03-31 23:32 ` Daniel Kahn Gillmor
@ 2019-04-01 13:23   ` Örjan Ekeberg
  0 siblings, 0 replies; 3+ messages in thread
From: Örjan Ekeberg @ 2019-04-01 13:23 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, notmuch

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:
> This seems reasonable to me.  I'd personally like forwarded messages to
> show up connected to the same thread os the originals, and i don't see a
> downside to it.

From what I can see, GMail and Outlook already does this (include a
references-header in forwarding messages), so it seems unlikely that
notmuch/emacs behaving the same would cause incompatibility issues.

/Örjan

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

end of thread, other threads:[~2019-04-01 13:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 12:01 [PATCH] emacs: Add References header to forwarded messages ekeberg
2019-03-31 23:32 ` Daniel Kahn Gillmor
2019-04-01 13:23   ` Örjan Ekeberg

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