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 4756E6DE114E for ; Fri, 12 Apr 2019 05:01:39 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -2.698 X-Spam-Level: X-Spam-Status: No, score=-2.698 tagged_above=-999 required=5 tests=[AWL=-0.196, 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 umlRu85Z2l0f for ; Fri, 12 Apr 2019 05:01:36 -0700 (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 740F36DE1020 for ; Fri, 12 Apr 2019 05:01:36 -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 5104F2750 for ; Fri, 12 Apr 2019 14:01:34 +0200 (CEST) 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 kvVmqEZdAPrA; Fri, 12 Apr 2019 14:01:33 +0200 (CEST) X-KTH-Auth: ekeberg [2001:6b0:1:1de0:5018:5c50:6d6d:7a4] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1555070493; bh=N57O9yONOaOitzUeFRqfYd++0zeSG1ZkTI4UABQYasM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PsTJ4lKDDJuupELxwkx6akrJFCLGhym7Ef1RjLDmp9pPTwcTMlMzpaDTvSFklRvZm zhf9B+bS126X6Kxxc9qzHK2CW3+u/u40VvdTdPT5y0I7gyFER9qyC8r1vRvYrJX1Ic fWiuGzMl83Z77egEZoz7JV3Kz6FTR8MXq+sI8vjU= X-KTH-mail-from: ekeberg@kth.se Received: from swing.nada.kth.se (unknown [IPv6:2001:6b0:1:1de0:5018:5c50:6d6d:7a4]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 944DA2B01; Fri, 12 Apr 2019 14:01:33 +0200 (CEST) From: =?UTF-8?q?=C3=96rjan=20Ekeberg?= To: notmuch@notmuchmail.org Subject: [PATCH v4 1/4] emacs: Add References header to forwarded messages Date: Fri, 12 Apr 2019 14:01:10 +0200 Message-Id: <20190412120113.8047-2-ekeberg@kth.se> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412120113.8047-1-ekeberg@kth.se> References: <20190404230126.4283-1-ekeberg@kth.se> <20190412120113.8047-1-ekeberg@kth.se> MIME-Version: 1.0 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, 12 Apr 2019 12:01:39 -0000 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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 708db248..23f3d8b1 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) ;; List of accumulated message-references 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,8 @@ 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)) + (push (message-fetch-field "Message-ID") forward-references)) ;; Make a copy ready to be forwarded in the ;; composition buffer. (message-forward-make-body temp-buffer) @@ -503,7 +505,10 @@ 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: " + (mapconcat 'identity forward-references " ")))) ;; `message-forward-make-body' shows the User-agent header. Hide ;; it again. -- 2.20.1