mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 12:28:09 +01:00
New function notmuch-search-operate-all: operate on all messages in the current query.
It is often convenient to change tags on several messages at once. This function applies any number of tag whitespace-delimited tag modifications to all messages matching the current query. I have bound this to `*'. Signed-off-by: Jed Brown <jed@59A2.org>
This commit is contained in:
parent
b7898b0c2a
commit
7293d84826
1 changed files with 24 additions and 0 deletions
24
notmuch.el
24
notmuch.el
|
@ -801,6 +801,7 @@ thread from that buffer can be show when done with this one)."
|
||||||
(define-key map [mouse-1] 'notmuch-search-show-thread)
|
(define-key map [mouse-1] 'notmuch-search-show-thread)
|
||||||
(define-key map "+" 'notmuch-search-add-tag)
|
(define-key map "+" 'notmuch-search-add-tag)
|
||||||
(define-key map "-" 'notmuch-search-remove-tag)
|
(define-key map "-" 'notmuch-search-remove-tag)
|
||||||
|
(define-key map "*" 'notmuch-search-operate-all)
|
||||||
(define-key map "<" 'beginning-of-buffer)
|
(define-key map "<" 'beginning-of-buffer)
|
||||||
(define-key map ">" 'notmuch-search-goto-last-thread)
|
(define-key map ">" 'notmuch-search-goto-last-thread)
|
||||||
(define-key map "=" 'notmuch-search-refresh-view)
|
(define-key map "=" 'notmuch-search-refresh-view)
|
||||||
|
@ -1001,6 +1002,29 @@ This function advances point to the next line when finished."
|
||||||
(set 'more nil))))))
|
(set 'more nil))))))
|
||||||
(delete-process proc))))
|
(delete-process proc))))
|
||||||
|
|
||||||
|
(defun notmuch-search-operate-all (action)
|
||||||
|
"Operate on all messages matching the current query. Any
|
||||||
|
number of whitespace separated actions can be given. Each action
|
||||||
|
must have one of the two forms
|
||||||
|
|
||||||
|
+tagname Add the tag `tagname'
|
||||||
|
-tagname Remove the tag `tagname'
|
||||||
|
|
||||||
|
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 " +")))
|
||||||
|
;; Perform some validation
|
||||||
|
(let ((words action-split))
|
||||||
|
(when (null words) (error "No operation given"))
|
||||||
|
(while words
|
||||||
|
(unless (string-match-p "^[\+\-][_\+\-\\w]+$" (car words))
|
||||||
|
(error "Action must be of the form `+thistag -that_tag'"))
|
||||||
|
(setq words (cdr words))))
|
||||||
|
(apply 'notmuch-call-notmuch-process "tag"
|
||||||
|
(append action-split (list notmuch-search-query-string) nil))))
|
||||||
|
|
||||||
(defun notmuch-search (query &optional oldest-first)
|
(defun notmuch-search (query &optional oldest-first)
|
||||||
"Run \"notmuch search\" with the given query string and display results."
|
"Run \"notmuch search\" with the given query string and display results."
|
||||||
(interactive "sNotmuch search: ")
|
(interactive "sNotmuch search: ")
|
||||||
|
|
Loading…
Reference in a new issue