unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 7/8] pick: Use interactive specifications for tag changes
Date: Tue, 22 Oct 2013 20:22:00 -0400	[thread overview]
Message-ID: <1382487721-31776-8-git-send-email-amdragon@mit.edu> (raw)
In-Reply-To: <1382487721-31776-1-git-send-email-amdragon@mit.edu>

---
 contrib/notmuch-pick/notmuch-pick.el | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el
index 8f504ed..13682ea 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -37,7 +37,7 @@
 (declare-function notmuch-show-strip-re "notmuch-show" (subject))
 (declare-function notmuch-show-spaces-n "notmuch-show" (n))
 (declare-function notmuch-read-query "notmuch" (prompt))
-(declare-function notmuch-read-tag-changes "notmuch" (&optional initial-input &rest search-terms))
+(declare-function notmuch-read-tag-changes "notmuch" (current-tags &optional prompt initial-input))
 (declare-function notmuch-update-tags "notmuch" (current-tags tag-changes))
 (declare-function notmuch-hello-trim "notmuch-hello" (search))
 (declare-function notmuch-search-find-thread-id "notmuch" ())
@@ -372,21 +372,24 @@ Does NOT change the database."
       (notmuch-pick-set-tags new-tags)
       (notmuch-pick-refresh-result))))
 
-(defun notmuch-pick-tag (&optional tag-changes)
+(defun notmuch-pick-tag (tag-changes)
   "Change tags for the current message"
-  (interactive)
-  (setq tag-changes (notmuch-tag (notmuch-pick-get-message-id) tag-changes))
+  (interactive
+   (list (notmuch-read-tag-changes (notmuch-pick-get-tags) "Tag message")))
+  (notmuch-tag (notmuch-pick-get-message-id) tag-changes)
   (notmuch-pick-tag-update-display tag-changes))
 
-(defun notmuch-pick-add-tag ()
+(defun notmuch-pick-add-tag (tag-changes)
   "Same as `notmuch-pick-tag' but sets initial input to '+'."
-  (interactive)
-  (notmuch-pick-tag "+"))
+  (interactive
+   (list (notmuch-read-tag-changes (notmuch-pick-get-tags) "Tag message" "+")))
+  (notmuch-pick-tag tag-changes))
 
-(defun notmuch-pick-remove-tag ()
+(defun notmuch-pick-remove-tag (tag-changes)
   "Same as `notmuch-pick-tag' but sets initial input to '-'."
-  (interactive)
-  (notmuch-pick-tag "-"))
+  (interactive
+   (list (notmuch-read-tag-changes (notmuch-pick-get-tags) "Tag message" "-")))
+  (notmuch-pick-tag tag-changes))
 
 ;; The next two functions close the message window before searching or
 ;; picking but they do so after the user has entered the query (in
@@ -626,13 +629,16 @@ message will be \"unarchived\", i.e. the tag changes in
 	     (notmuch-pick-thread-mapcar 'notmuch-pick-get-message-id)
 	     " or "))
 
-(defun notmuch-pick-tag-thread (&optional tag-changes)
+(defun notmuch-pick-tag-thread (tag-changes)
   "Tag all messages in the current thread"
-  (interactive)
+  (interactive
+   (let ((tags (apply #'append (notmuch-pick-thread-mapcar
+				(lambda () (notmuch-pick-get-tags))))))
+     (list (notmuch-read-tag-changes tags "Tag thread"))))
   (when (notmuch-pick-get-message-properties)
-    (let ((tag-changes (notmuch-tag (notmuch-pick-get-messages-ids-thread-search) tag-changes)))
-      (notmuch-pick-thread-mapcar
-       (lambda () (notmuch-pick-tag-update-display tag-changes))))))
+    (notmuch-tag (notmuch-pick-get-messages-ids-thread-search) tag-changes)
+    (notmuch-pick-thread-mapcar
+     (lambda () (notmuch-pick-tag-update-display tag-changes)))))
 
 (defun notmuch-pick-archive-thread (&optional unarchive)
   "Archive each message in thread.
-- 
1.8.4.rc3

  parent reply	other threads:[~2013-10-23  0:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23  0:21 [PATCH v2 0/8] Improve tag change completion Austin Clements
2013-10-23  0:21 ` [PATCH v2 1/8] emacs: Fix misuse of `notmuch-tag' Austin Clements
2013-10-23  0:21 ` [PATCH v2 2/8] emacs: Take prompt and current tags in `notmuch-read-tag-changes' Austin Clements
2013-10-23  0:21 ` [PATCH v2 3/8] emacs: Use interactive specifications for tag changes in show Austin Clements
2013-10-23  0:21 ` [PATCH v2 4/8] emacs: Use interactive specifications for tag changes in search Austin Clements
2013-10-23  0:21 ` [PATCH v2 5/8] pick: Fix incorrect use of `notmuch-pick-tag' Austin Clements
2013-10-23  0:21 ` [PATCH v2 6/8] pick: Use list form of tag-changes in test Austin Clements
2013-10-23  0:22 ` Austin Clements [this message]
2013-10-23  0:22 ` [PATCH v2 8/8] emacs: Remove interactive behavior of `notmuch-tag' Austin Clements
2013-10-23 16:06 ` [PATCH v2 0/8] Improve tag change completion Mark Walters
2013-10-23 18:28   ` Tomi Ollila
2013-10-26  0:37 ` David Bremner

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=1382487721-31776-8-git-send-email-amdragon@mit.edu \
    --to=amdragon@mit.edu \
    --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).