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 934CD6DE13FF for ; Fri, 12 Apr 2019 05:01:56 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -2.695 X-Spam-Level: X-Spam-Status: No, score=-2.695 tagged_above=-999 required=5 tests=[AWL=-0.193, 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 0lCOOfuIv8Sd for ; Fri, 12 Apr 2019 05:01:56 -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 8A5756DE140C for ; Fri, 12 Apr 2019 05:01:45 -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 D80AB2750 for ; Fri, 12 Apr 2019 14:01:43 +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 TixDulh4BGQO; Fri, 12 Apr 2019 14:01:43 +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=1555070503; bh=W8cEPNlm4x12Yp3nE/+AMm+kqGzbW7qjPc7ndHXzgtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YUrzFORusOBuaNYg1VRQRBirxI7ZGa/1e7fzsKLUgOqNmRZsd2Jcr2wwYmHbZTY4c Ru5eeAe3M31Gc57bNtG2kwCwCwm9E5AznlKv264+gaAmMLNAOg245jX7u4DqSew4X0 m5/42mW9ce/I5aBT48+jpCTKgrzMRuD2FP4lvcbU= 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 24CBA2854; Fri, 12 Apr 2019 14:01:43 +0200 (CEST) From: =?UTF-8?q?=C3=96rjan=20Ekeberg?= To: notmuch@notmuchmail.org Subject: [PATCH v4 3/4] emacs: Tag forwarded messages with +forwarded (customizable) Date: Fri, 12 Apr 2019 14:01:12 +0200 Message-Id: <20190412120113.8047-4-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:56 -0000 Use the buffer-local variable notmuch-message-queued-tag-changes to change tags when the forwarding message is sent. --- emacs/notmuch-message.el | 13 +++++++++++++ emacs/notmuch-mua.el | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-message.el b/emacs/notmuch-message.el index 0d4a8eee..0164472f 100644 --- a/emacs/notmuch-message.el +++ b/emacs/notmuch-message.el @@ -37,6 +37,19 @@ the \"inbox\" and \"todo\" tags, you would set: :type '(repeat string) :group 'notmuch-send) +(defcustom notmuch-message-forwarded-tags '("+forwarded") + "List of tag changes to apply to a message when it has been forwarded. + +Tags starting with \"+\" (or not starting with either \"+\" or +\"-\") in the list will be added, and tags starting with \"-\" +will be removed from the message being forwarded. + +For example, if you wanted to add a \"forwarded\" tag and remove +the \"inbox\" tag, you would set: + (\"+forwarded\" \"-inbox\")" + :type '(repeat string) + :group 'notmuch-send) + (defconst notmuch-message-queued-tag-changes nil "List of messages and corresponding tag-changes to be applied when sending a message. diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 2f0de92c..94fa19d7 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -478,7 +478,8 @@ the From: address." (list (cons 'From (notmuch-mua-prompt-for-sender))))) forward-subject ;; Comes from the first message and is ;; applied later. - forward-references) ;; List of accumulated message-references of forwarded messages + forward-references ;; List of accumulated message-references of forwarded messages + forward-queries) ;; List of corresponding message-query ;; Generate the template for the outgoing message. (notmuch-mua-mail nil "" other-headers nil (notmuch-mua-get-switch-function)) @@ -497,7 +498,8 @@ the From: address." ;; always generate a forwarded subject, then use the ;; last (i.e. first) one. (setq forward-subject (message-make-forward-subject)) - (push (message-fetch-field "Message-ID") forward-references)) + (push (message-fetch-field "Message-ID") forward-references) + (push id forward-queries)) ;; Make a copy ready to be forwarded in the ;; composition buffer. (message-forward-make-body temp-buffer) @@ -516,6 +518,14 @@ the From: address." (message-add-header (concat "References: " (mapconcat 'identity forward-references " ")))) + ;; Create a buffer-local queue for tag changes triggered when sending the message + (when notmuch-message-forwarded-tags + (setq-local notmuch-message-queued-tag-changes + (loop for id in forward-queries + collect + (cons id + notmuch-message-forwarded-tags)))) + ;; `message-forward-make-body' shows the User-agent header. Hide ;; it again. (message-hide-headers) -- 2.20.1