mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 10:58:10 +01:00
Clean up code duplication in adding or removing tag by region.
Clean up code duplication, as per Carl's suggestion, by making notmuch-search-{add/remove}-tag-thread a special case of the -region commands, where the region in question is between (point) and (point).
This commit is contained in:
parent
2fbb6d05a9
commit
db96d67ba2
1 changed files with 2 additions and 4 deletions
|
@ -507,8 +507,7 @@ and will also appear in a buffer named \"*Notmuch errors*\"."
|
||||||
output)))
|
output)))
|
||||||
|
|
||||||
(defun notmuch-search-add-tag-thread (tag)
|
(defun notmuch-search-add-tag-thread (tag)
|
||||||
(notmuch-call-notmuch-process "tag" (concat "+" tag) (notmuch-search-find-thread-id))
|
(notmuch-search-add-tag-region tag (point) (point)))
|
||||||
(notmuch-search-set-tags (delete-dups (sort (cons tag (notmuch-search-get-tags)) 'string<))))
|
|
||||||
|
|
||||||
(defun notmuch-search-add-tag-region (tag beg end)
|
(defun notmuch-search-add-tag-region (tag beg end)
|
||||||
(let ((search-id-string (mapconcat 'identity (notmuch-search-find-thread-id-region beg end) " or ")))
|
(let ((search-id-string (mapconcat 'identity (notmuch-search-find-thread-id-region beg end) " or ")))
|
||||||
|
@ -522,8 +521,7 @@ and will also appear in a buffer named \"*Notmuch errors*\"."
|
||||||
(forward-line))))))
|
(forward-line))))))
|
||||||
|
|
||||||
(defun notmuch-search-remove-tag-thread (tag)
|
(defun notmuch-search-remove-tag-thread (tag)
|
||||||
(notmuch-call-notmuch-process "tag" (concat "-" tag) (notmuch-search-find-thread-id))
|
(notmuch-search-remove-tag-region tag (point) (point)))
|
||||||
(notmuch-search-set-tags (delete tag (notmuch-search-get-tags))))
|
|
||||||
|
|
||||||
(defun notmuch-search-remove-tag-region (tag beg end)
|
(defun notmuch-search-remove-tag-region (tag beg end)
|
||||||
(let ((search-id-string (mapconcat 'identity (notmuch-search-find-thread-id-region beg end) " or ")))
|
(let ((search-id-string (mapconcat 'identity (notmuch-search-find-thread-id-region beg end) " or ")))
|
||||||
|
|
Loading…
Reference in a new issue