aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch.el
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-11-02 15:48:21 -0800
committerGravatar Carl Worth <cworth@cworth.org>2009-11-02 15:48:21 -0800
commitd4c4318fb95ba2ed86823389cf82b11a2bcae073 (patch)
tree39545ea1246d49b20ebd9ff95ba5751ac18d2570 /notmuch.el
parentfa226a7a10ba95f8d8a7ff92dbfc44f6404d9d4d (diff)
notmuch.el: Implement visual feedback for add/remove tags.
There's no undo still, but at least you can see what you are doing now.
Diffstat (limited to 'notmuch.el')
-rw-r--r--notmuch.el28
1 files changed, 26 insertions, 2 deletions
diff --git a/notmuch.el b/notmuch.el
index cedbdb33..73f02963 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -112,13 +112,37 @@
(error (buffer-substring beg end))
))))))
+(defun notmuch-search-set-tags (tags)
+ (save-excursion
+ (end-of-line)
+ (re-search-backward "(")
+ (forward-char)
+ (let ((beg (point))
+ (inhibit-read-only t))
+ (re-search-forward ")")
+ (backward-char)
+ (let ((end (point)))
+ (delete-region beg end)
+ (insert (mapconcat 'identity tags " "))))))
+
+(defun notmuch-search-get-tags ()
+ (save-excursion
+ (end-of-line)
+ (re-search-backward "(")
+ (let ((beg (+ (point) 1)))
+ (re-search-forward ")")
+ (let ((end (- (point) 1)))
+ (split-string (buffer-substring beg end))))))
+
(defun notmuch-search-add-tag (tag)
(interactive "sTag to add: ")
- (notmuch-search-call-notmuch-process "tag" (concat "+" tag) (concat "thread:" (notmuch-search-find-thread-id))))
+ (notmuch-search-call-notmuch-process "tag" (concat "+" tag) (concat "thread:" (notmuch-search-find-thread-id)))
+ (notmuch-search-set-tags (delete-dups (sort (cons tag (notmuch-search-get-tags)) 'string<))))
(defun notmuch-search-remove-tag (tag)
(interactive "sTag to remove: ")
- (notmuch-search-call-notmuch-process "tag" (concat "-" tag) (concat "thread:" (notmuch-search-find-thread-id))))
+ (notmuch-search-call-notmuch-process "tag" (concat "-" tag) (concat "thread:" (notmuch-search-find-thread-id)))
+ (notmuch-search-set-tags (delete tag (notmuch-search-get-tags))))
(defun notmuch-search-archive-thread ()
(interactive)