unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Pieter Praet <pieter@praet.org>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH 6/6] emacs: make `notmuch-search-operate-all' operate on threads, not messages
Date: Sun, 10 Jul 2011 17:55:35 +0200	[thread overview]
Message-ID: <1310313335-4159-7-git-send-email-pieter@praet.org> (raw)
In-Reply-To: <1310313335-4159-1-git-send-email-pieter@praet.org>

In order to be consistent with `notmuch-search-{add,remove}-tag' ("+"/"-"),
`notmuch-search-operate-all' ("*") should operate on matching threads
instead of matching messages.

Signed-off-by: Pieter Praet <pieter@praet.org>
---
 emacs/notmuch.el |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f11ec24..07899b7 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -834,9 +834,9 @@ non-authors is found, assume that all of the authors match."
       (delete-process proc))))
 
 (defun notmuch-search-operate-all (action)
-  "Add/remove tags from all matching messages.
+  "Add/remove tags from all matching threads.
 
-This command adds or removes tags from all messages matching the
+This command adds or removes tags from all threads matching the
 current search terms. When called interactively, this command
 will prompt for tags to be added or removed. Tags prefixed with
 '+' will be added and tags prefixed with '-' will be removed.
@@ -845,7 +845,10 @@ Each character of the tag name may consist of alphanumeric
 characters as well as `_.+-'.
 "
   (interactive "sOperation (+add -drop): notmuch tag ")
-  (let ((action-split (split-string action " +")))
+  (let ((action-split (split-string action " +"))
+        (threads (mapconcat 'identity
+                           (notmuch-search-find-thread-id-region (point-min) (- (point-max) 2))
+                           " or ")))
     ;; Perform some validation
     (let ((words action-split))
       (when (null words) (error "No operation given"))
@@ -853,7 +856,7 @@ characters as well as `_.+-'.
 	(unless (string-match-p "^[-+][-+_.[:word:]]+$" (car words))
 	  (error "Action must be of the form `+thistag -that_tag'"))
 	(setq words (cdr words))))
-    (apply 'notmuch-tag notmuch-search-query-string action-split)))
+    (apply 'notmuch-tag threads action-split)))
 
 (defun notmuch-search-buffer-title (query)
   "Returns the title for a buffer with notmuch search results."
-- 
1.7.5.4

  parent reply	other threads:[~2011-07-10 15:56 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-10 15:55 Extend test coverage wrt tagging Pieter Praet
2011-07-10 15:55 ` [PATCH 1/6] test: emacs: rename subtest "Reply within emacs" to "Compose reply in emacs" Pieter Praet
2011-07-10 15:55 ` [PATCH 2/6] test: emacs: add test for sending a reply from within Emacs Pieter Praet
2011-07-10 15:55 ` [PATCH 3/6] test: emacs: add test to verify that the message being replied to is tagged as such Pieter Praet
2011-07-10 15:55 ` [PATCH 4/6] test: emacs: add test for `notmuch-search-operate-all' Pieter Praet
2011-07-10 15:55 ` [PATCH 5/6] test: emacs: `notmuch-search-operate-all' should operate on threads, not messages Pieter Praet
2011-07-10 15:55 ` Pieter Praet [this message]
2011-11-12 16:13   ` [PATCH 6/6] emacs: make `notmuch-search-operate-all' " David Bremner
2011-11-12 16:35     ` Austin Clements
2011-11-16 13:55       ` Pieter Praet
2012-02-19 20:38 ` Pieter Praet
2012-02-19 20:38   ` [PATCH v2 1/4] test: emacs: rename subtest "Reply within emacs" Pieter Praet
2012-02-20 12:16     ` Dmitry Kurochkin
2012-02-19 20:38   ` [PATCH v2 2/4] test: emacs: new test "notmuch-search: replying to a thread (sending)" Pieter Praet
2012-02-19 21:04     ` Tomi Ollila
2012-02-22 18:49       ` Pieter Praet
2012-02-20 12:44     ` Dmitry Kurochkin
2012-02-22 18:51       ` Pieter Praet
2012-02-19 20:38   ` [PATCH v2 3/4] test: emacs: new test "notmuch-search: when reply is sent, parent message should be tagged 'replied'" Pieter Praet
2012-02-20 12:20     ` Dmitry Kurochkin
2012-02-22 18:52       ` Pieter Praet
2012-02-19 20:38   ` [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of all matching messages" Pieter Praet
2012-02-19 21:08     ` Tomi Ollila
2012-02-22 18:53       ` Pieter Praet
2012-02-20 12:25     ` Dmitry Kurochkin
2012-02-22 18:53       ` Pieter Praet
2012-02-22 18:54     ` [PATCH v3] " Pieter Praet
2012-03-07 19:49       ` [PATCH v4] " Pieter Praet
2012-03-11 18:42         ` Tomi Ollila

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=1310313335-4159-7-git-send-email-pieter@praet.org \
    --to=pieter@praet.org \
    --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).