[PATCH 1/2] emacs: maildir fcc make insert more flexible
David Edmondson
dme at dme.org
Mon Aug 28 03:23:45 PDT 2017
On Monday, 2017-08-28 at 08:32:21 +0100, Mark Walters wrote:
> This changeset makes the function
> notmuch-maildir-fcc-with-notmuch-insert slightly more flexible by
> allowing some of the prompts to be controlled by the caller.
> ---
> emacs/notmuch-maildir-fcc.el | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
> index 1551e8b..acff24d 100644
> --- a/emacs/notmuch-maildir-fcc.el
> +++ b/emacs/notmuch-maildir-fcc.el
> @@ -227,7 +227,7 @@ should be a list of tag changes to apply to the inserted message."
> (apply 'notmuch-call-notmuch-process
> :stdin-string (buffer-string) "insert" args)))
>
> -(defun notmuch-maildir-fcc-with-notmuch-insert (fcc-header &optional create)
> +(defun notmuch-maildir-fcc-with-notmuch-insert (fcc-header &optional create header-name)
Given that this is not FCC specific, perhaps rename it?
> "Store message with notmuch insert.
>
> The fcc-header should be of the form \"folder +tag1 -tag2\" where
I realise that this patch set didn't add this string, but it is mildly
ridiculous. There's no reason that we couldn't use a list, where a
leading “+” or “-” indicates a tag and anything else is a folder.
Even two variables (one for folder and another for tags) would be an
improvement
> @@ -239,7 +239,8 @@ quoting each space with an immediately preceding backslash
> or surrounding the entire folder name in double quotes.
>
> If CREATE is non-nil then create the folder if necessary."
> - (let* ((args (split-string-and-unquote fcc-header))
> + (let* ((header-name (or header-name "Fcc header"))
> + (args (split-string-and-unquote fcc-header))
> (folder (car args))
> (tags (cdr args)))
> (condition-case nil
> @@ -250,14 +251,17 @@ If CREATE is non-nil then create the folder if necessary."
> ;; how to deal with it.
> (error
> (let ((response (notmuch-read-char-choice
> - "Insert failed: (r)etry, (c)reate folder, (i)gnore, or (e)dit the header? "
> + (concat
> + "Insert failed: (r)etry, (c)reate folder, (i)gnore, or (e)dit the "
> + header-name "? ")
> '(?r ?c ?i ?e))))
> (case response
> - (?r (notmuch-maildir-fcc-with-notmuch-insert fcc-header))
> - (?c (notmuch-maildir-fcc-with-notmuch-insert fcc-header 't))
> + (?r (notmuch-maildir-fcc-with-notmuch-insert fcc-header nil header-name))
> + (?c (notmuch-maildir-fcc-with-notmuch-insert fcc-header 't header-name))
> (?i 't)
> (?e (notmuch-maildir-fcc-with-notmuch-insert
> - (read-from-minibuffer "Fcc header: " fcc-header)))))))))
> + (read-from-minibuffer (concat header-name ": ") fcc-header)
> + nil header-name))))))))
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> --
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
dme.
--
Walk without rhythm and it won't attract the worm.
More information about the notmuch
mailing list