unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/2] emacs: maildir fcc make insert more flexible
Date: Mon, 28 Aug 2017 08:32:21 +0100	[thread overview]
Message-ID: <1503905542-19961-2-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1503905542-19961-1-git-send-email-markwalters1009@gmail.com>

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)
   "Store message with notmuch insert.
 
 The fcc-header should be of the form \"folder +tag1 -tag2\" where
@@ -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

  reply	other threads:[~2017-08-28  7:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28  7:32 [PATCH 0/2] emacs: allow message/rfc822 to be inserted in the mailstore Mark Walters
2017-08-28  7:32 ` Mark Walters [this message]
2017-08-28 10:23   ` [PATCH 1/2] emacs: maildir fcc make insert more flexible David Edmondson
2017-08-28 11:27     ` Mark Walters
2017-08-28 13:40       ` David Edmondson
2017-09-07 11:23         ` David Bremner
2017-08-28  7:32 ` [PATCH 2/2] emacs: show: allow user to insert rfc822 parts as messages Mark Walters
2017-08-28 10:26   ` David Edmondson
2017-08-28 11:29     ` Mark Walters

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503905542-19961-2-git-send-email-markwalters1009@gmail.com \
    --to=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).