From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 85CBF6DE0F0D for ; Fri, 29 Mar 2019 05:10:11 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -2.502 X-Spam-Level: X-Spam-Status: No, score=-2.502 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hbIJkxIVSTSI for ; Fri, 29 Mar 2019 05:10:09 -0700 (PDT) X-Greylist: delayed 466 seconds by postgrey-1.36 at arlo; Fri, 29 Mar 2019 05:10:09 PDT Received: from smtp-4.sys.kth.se (smtp-4.sys.kth.se [130.237.48.193]) by arlo.cworth.org (Postfix) with ESMTPS id 9E90A6DE0EC6 for ; Fri, 29 Mar 2019 05:10:09 -0700 (PDT) Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id EB4D628F6 for ; Fri, 29 Mar 2019 13:02:19 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 80OnpoKDGCqC; Fri, 29 Mar 2019 13:02:18 +0100 (CET) X-KTH-Auth: ekeberg [2001:6b0:1:1de0:e0d2:50f6:4957:3b89] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1553860938; bh=QG3AqwBoPjWVTDtfjFvJ3QpLJfrlVdtyGvLLtcol0fo=; h=From:To:Cc:Subject:Date; b=hizLeEjeAqZChHhy4SaWE4tO70WdfG815o92txK2l8rmLXflntHBIIq/tRn0cuUwH xlgT2/u+VzyW9ScC8bXiajSbpWax3KbqpBJlrPSmD5fbEg80FCD7DGM8JUkwN4qoAq 0VSdl5UcgInUWCtiwXB7fCE3dbE0swkKLH0Sbo6M= X-KTH-mail-from: ekeberg@kth.se Received: from swing.nada.kth.se (unknown [IPv6:2001:6b0:1:1de0:e0d2:50f6:4957:3b89]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 669E1267B; Fri, 29 Mar 2019 13:02:17 +0100 (CET) From: ekeberg@kth.se To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Add References header to forwarded messages Date: Fri, 29 Mar 2019 13:01:09 +0100 Message-Id: <20190329120109.3477-1-ekeberg@kth.se> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Mar 2019 12:10:11 -0000 From: Örjan Ekeberg 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