mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 12:28:09 +01:00
notmuch.el: When removing tags, offer only those a msg/thread has set.
When removing a tag from a message or thread, build a completion buffer which contains only tags that the message or thread has really set. Signed-off-by: Jan Janak <jan@ryngle.com>
This commit is contained in:
parent
5a447b00ac
commit
5ab69232bc
1 changed files with 4 additions and 4 deletions
|
@ -137,11 +137,11 @@ within the current window."
|
||||||
(or (memq prop buffer-invisibility-spec)
|
(or (memq prop buffer-invisibility-spec)
|
||||||
(assq prop buffer-invisibility-spec)))))
|
(assq prop buffer-invisibility-spec)))))
|
||||||
|
|
||||||
(defun notmuch-select-tag-with-completion (prompt)
|
(defun notmuch-select-tag-with-completion (prompt &rest search-terms)
|
||||||
(let ((tag-list
|
(let ((tag-list
|
||||||
(with-output-to-string
|
(with-output-to-string
|
||||||
(with-current-buffer standard-output
|
(with-current-buffer standard-output
|
||||||
(call-process notmuch-command nil t nil "search-tags")))))
|
(apply 'call-process notmuch-command nil t nil "search-tags" search-terms)))))
|
||||||
(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
|
(completing-read prompt (split-string tag-list "\n+" t) nil nil nil)))
|
||||||
|
|
||||||
(defun notmuch-show-next-line ()
|
(defun notmuch-show-next-line ()
|
||||||
|
@ -218,7 +218,7 @@ Unlike builtin `next-line' this version accepts no arguments."
|
||||||
(defun notmuch-show-remove-tag (&rest toremove)
|
(defun notmuch-show-remove-tag (&rest toremove)
|
||||||
"Remove a tag from the current message."
|
"Remove a tag from the current message."
|
||||||
(interactive
|
(interactive
|
||||||
(list (notmuch-select-tag-with-completion "Tag to remove: ")))
|
(list (notmuch-select-tag-with-completion "Tag to remove: " (notmuch-show-get-message-id))))
|
||||||
(let ((tags (notmuch-show-get-tags)))
|
(let ((tags (notmuch-show-get-tags)))
|
||||||
(if (intersection tags toremove :test 'string=)
|
(if (intersection tags toremove :test 'string=)
|
||||||
(progn
|
(progn
|
||||||
|
@ -940,7 +940,7 @@ and will also appear in a buffer named \"*Notmuch errors*\"."
|
||||||
|
|
||||||
(defun notmuch-search-remove-tag (tag)
|
(defun notmuch-search-remove-tag (tag)
|
||||||
(interactive
|
(interactive
|
||||||
(list (notmuch-select-tag-with-completion "Tag to remove: ")))
|
(list (notmuch-select-tag-with-completion "Tag to remove: " (notmuch-search-find-thread-id))))
|
||||||
(notmuch-call-notmuch-process "tag" (concat "-" tag) (notmuch-search-find-thread-id))
|
(notmuch-call-notmuch-process "tag" (concat "-" tag) (notmuch-search-find-thread-id))
|
||||||
(notmuch-search-set-tags (delete tag (notmuch-search-get-tags))))
|
(notmuch-search-set-tags (delete tag (notmuch-search-get-tags))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue