From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eFIvHzSoCmHKbwEAgWs5BA (envelope-from ) for ; Wed, 04 Aug 2021 16:46:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id QPbMGjSoCmFmSgAAbx9fmQ (envelope-from ) for ; Wed, 04 Aug 2021 14:46:12 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2692F1263B for ; Wed, 4 Aug 2021 16:46:11 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 4209329194; Wed, 4 Aug 2021 10:46:07 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9729129193 for ; Wed, 4 Aug 2021 10:46:04 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 559D15FD5C; Wed, 4 Aug 2021 10:46:04 -0400 (EDT) Received: (nullmailer pid 4040582 invoked by uid 1000); Wed, 04 Aug 2021 14:46:03 -0000 Resent-To: notmuch@notmuchmail.org Resent-From: David Bremner Resent-Date: Wed, 04 Aug 2021 11:46:03 -0300 Resent-Message-ID: <87pmutw9n8.fsf@tethera.net> Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by fethera.tethera.net (Postfix) with ESMTPS id CC3B25FD5B for ; Mon, 2 Aug 2021 18:10:14 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id BBE7C163CB for ; Tue, 3 Aug 2021 00:10:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1627942208; bh=HeTh53yaPiebefk HZq1rwqv9kvCefYgMuT+pGyoP7VI=; b=WFQXg0SRwhmVZ1jmJVfdaMfGVjqGw2Z KpZjzUoW9RLuwQRDNMa/3MGo1hmyVVyZR+J76+ZCCxj2BU4AdJ3bmII7XIcC9eOG s/i1EPQ+x1VjJ4Wjg/kQGd1+j+LEp3ajI8swrO3H/jI409grD0WKlP5o5S/umLmP kcPyiP/bw5wk= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id 2N3BjgeNM4N4 for ; Tue, 3 Aug 2021 00:10:08 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 8831F16400 for ; Tue, 3 Aug 2021 00:10:08 +0200 (CEST) From: Jonas Bernoulli To: David Bremner Subject: [PATCH] emacs: notmuch-fcc-header-setup: fix regression Date: Tue, 3 Aug 2021 00:10:08 +0200 Message-Id: <20210802221008.20978-1-jonas@bernoul.li> X-Mailer: git-send-email 2.31.1 In-Reply-To: <87czqw1621.fsf@tethera.net> References: <87czqw1621.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: MEPRV22N3HFZXYEGD62S2W6QDCGMWQ42 X-Message-ID-Hash: MEPRV22N3HFZXYEGD62S2W6QDCGMWQ42 X-MailFrom: jonas@bernoul.li X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1628088371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-to: resent-from:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=EEH4LW+rcu/W/ElkZLsFkCT9i//KRCf5N08T+r3R8Rw=; b=Z8hgGHmY1orVzJSxqy6lpQmScewe16vW4wfw9ag+IjBRLDxi9oTcVJ7NEKQIv3mbGVc4J6 2nLvZ7RV5tx4uNFtpdQF/fQ0Mv2GPucGWl1+58nnYH6RBj1mGohJKMzRpyyfX3eIjqRRbl sUo+dCb6D0R+9TP4gxmMHmk6xqI3/aOC32KAizyMHghRyUv/wmu/cg5zh9lbfmTUKzzeKg 3TJ4DadO7lXyQkreXx1mY7P4RgCKYc6x9+DRVkHYDfZYJayizgEJG0quftCceDhbO7MpKd +zBr3NfGDX0zFRrOyA/JiATvOH1o1Hai7SxuFVT/Iv1f65tU7akpBBj2njJk8g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628088371; a=rsa-sha256; cv=none; b=n8JzMoK5LU0rLQ+qBcbxppKs7AX30LTE9thPTYhOpxHRK+Pccu7ND0CXotx3uk87h8hjOz wd6IIaAFaIi0Yi8yZSMWUbcfquE+Sv1bsvQVajWrIHxC6TzMfy5yJO/fGNKhf9ktKloWjX SSpSgKnRZytboOA8sOG1StDo7LRZIzFnbem4KS9hu85qeClVV6LMk66ZSOy4JK7CtDudNj sOj+STaPLMim5FcM3AMZ2jB7XbYBZ8yEyw/B/Ft+10QPXyWCQuX7BzS40UMIOs0c9rOlZN s+DXEN4Vo6G1k9V1ZSGahBONtffTtrQCku2jZJwRRJ2eykx15O9xOIEJNcyyPA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=bernoul.li header.s=sel2011a header.b=WFQXg0SR; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 1.02 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=bernoul.li header.s=sel2011a header.b=WFQXg0SR; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 2692F1263B X-Spam-Score: 1.02 X-Migadu-Scanner: scn1.migadu.com X-TUID: EeAJVk4cqb6a With [1: 16b2db09] we lost the (undocumented) option to use no Fcc header only for From addresses matching a regexp. This brings back that feature and documents it. 1: 2021-01-15 16b2db0986ce0ed7c420a69d0a98bb41e9ca4bd8 emacs: various cosmetic improvements --- emacs/notmuch-maildir-fcc.el | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index c715532b..7e177bf7 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -41,16 +41,17 @@ (defcustom notmuch-fcc-dirs "sent" - a string: the value of `notmuch-fcc-dirs' is the Fcc header to be used. -- a list: the folder is chosen based on the From address of the - current message using a list of regular expressions and - corresponding folders: +- an alist: the folder is chosen based on the From address of + the current message according to an alist mapping regular + expressions to folders or nil: ((\"Sebastian@SSpaeth.de\" . \"privat\") (\"spaetz@sspaeth.de\" . \"OUTBOX.OSS\") (\".*\" . \"defaultinbox\")) - If none of the regular expressions match the From address, no - Fcc header will be added. + If none of the regular expressions match the From address, or + if the cdr of the matching entry is nil, then no Fcc header + will be added. If `notmuch-maildir-use-notmuch-insert' is set (the default) then the header should be of the form \"folder +tag1 -tag2\" where @@ -74,7 +75,8 @@ (defcustom notmuch-fcc-dirs "sent" (const :tag "No FCC header" nil) (string :tag "A single folder") (repeat :tag "A folder based on the From header" - (cons regexp (string :tag "Folder")))) + (cons regexp (choice (const :tag "No FCC header" nil) + (string :tag "Folder"))))) :require 'notmuch-fcc-initialization :group 'notmuch-send) @@ -105,13 +107,14 @@ (defun notmuch-fcc-header-setup () ;; Old style - no longer works. (error "Invalid `notmuch-fcc-dirs' setting (old style)")) ((listp notmuch-fcc-dirs) - (or (seq-some (let ((from (message-field-value "From"))) - (pcase-lambda (`(,regexp . ,folder)) - (and (string-match-p regexp from) - folder))) - notmuch-fcc-dirs) - (progn (message "No Fcc header added.") - nil))) + (if-let ((match (seq-some (let ((from (message-field-value "From"))) + (pcase-lambda (`(,regexp . ,folder)) + (and (string-match-p regexp from) + (cons t folder)))) + notmuch-fcc-dirs))) + (cdr match) + (message "No Fcc header added.") + nil)) (t (error "Invalid `notmuch-fcc-dirs' setting (neither string nor list)"))))) (when subdir -- 2.31.1