Hi Commit 16b2db0986ce ("emacs: various cosmetic improvements") switched over notmuch-fcc-header-setup to use 'seq-some' to parse the notmuch-fcc-dirs variables. However, this seems to have broken the use of 'nil' values in the list. Specifically, I have notmuch-fcc-dirs set to something like: '(("toke@onemail.alias" . "alias1/Sent +sent -unread") ("toke@another.alias" . nil) (".*" . "Sent +sent -unread")) and since that update, I end up with "Sent +sent -unread" as the FCC value for emails I initiate from toke@another.alias. Any chance this could be fixed? Thanks, -Toke
Toke Høiland-Jørgensen <toke@toke.dk> writes:
> Commit 16b2db0986ce ("emacs: various cosmetic improvements") switched
> over notmuch-fcc-header-setup to use 'seq-some' to parse the
> notmuch-fcc-dirs variables. However, this seems to have broken the use
> of 'nil' values in the list. Specifically, I have notmuch-fcc-dirs set
> to something like:
>
> '(("toke@onemail.alias" . "alias1/Sent +sent -unread")
> ("toke@another.alias" . nil)
> (".*" . "Sent +sent -unread"))
>
> and since that update, I end up with "Sent +sent -unread" as the FCC
> value for emails I initiate from toke@another.alias.
On the one hand that behaviour was undocumented. On the other hand, it
does seem like a useful thing to want to do. Hopefully Jonas can more
quickly untangle what happened there than I can.
d
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
Jonas Bernoulli <jonas@bernoul.li> writes:
> 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
applied to master.
d
Toke Høiland-Jørgensen <toke@toke.dk> writes:
> Hi
>
> Commit 16b2db0986ce ("emacs: various cosmetic improvements") switched
> over notmuch-fcc-header-setup to use 'seq-some' to parse the
> notmuch-fcc-dirs variables. However, this seems to have broken the use
> of 'nil' values in the list. Specifically, I have notmuch-fcc-dirs set
> to something like:
>
> '(("toke@onemail.alias" . "alias1/Sent +sent -unread")
> ("toke@another.alias" . nil)
> (".*" . "Sent +sent -unread"))
>
> and since that update, I end up with "Sent +sent -unread" as the FCC
> value for emails I initiate from toke@another.alias.
>
> Any chance this could be fixed?
This should be fixed in commit b03b0d4e
David Bremner <david@tethera.net> writes:
> Toke Høiland-Jørgensen <toke@toke.dk> writes:
>
>> Hi
>>
>> Commit 16b2db0986ce ("emacs: various cosmetic improvements") switched
>> over notmuch-fcc-header-setup to use 'seq-some' to parse the
>> notmuch-fcc-dirs variables. However, this seems to have broken the use
>> of 'nil' values in the list. Specifically, I have notmuch-fcc-dirs set
>> to something like:
>>
>> '(("toke@onemail.alias" . "alias1/Sent +sent -unread")
>> ("toke@another.alias" . nil)
>> (".*" . "Sent +sent -unread"))
>>
>> and since that update, I end up with "Sent +sent -unread" as the FCC
>> value for emails I initiate from toke@another.alias.
>>
>> Any chance this could be fixed?
>
> This should be fixed in commit b03b0d4e
Indeed it is - thanks! :)
-Toke