-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathakmuch-tag.el
56 lines (49 loc) · 1.36 KB
/
akmuch-tag.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
(defun akmuch-tag (tags &optional marked)
(interactive "sTags: ")
(let ((tag-list (split-string tags " "))
arg-list ident buff (current-buffer) tbuff)
(if marked
(setq ident "tag:*")
(setq ident (akmuch-get-thread-id)))
(setq tag-list
(mapcar (lambda (s)
(if (string-match "^[-\\+]" s) s (concat "+" s)))
tag-list))
(setq arg-list
(append '(call-process "notmuch" nil nil nil "tag")
tag-list
(list "--" ident)))
(eval arg-list))
(akmuch-refresh))
(defun akmuch-delete (&optional from-here)
(interactive "P")
(let ((tid (akmuch-get-thread-id)))
(if (and from-here (or (eq akmuch-display-type 'search)
(eq akmuch-display-type 'threadlist)))
(save-excursion
(while (< (point) (point-max))
(forward-line 1)
(setq tid (concat tid " " (akmuch-get-thread-id))))))
(call-process "notmuch" nil nil nil "tag"
"-inbox" "-unread" tid)
(if (eq (point-at-eol) (point-max))
(forward-line -1)
(forward-line))
(akmuch-refresh)))
(defun akmuch-mark ()
(interactive)
(akmuch-tag "*"))
(defun akmuch-mark-move ()
(interactive)
(akmuch-mark)
(akmuch-next))
(defun akmuch-unmark ()
(interactive)
(akmuch-tag "-*"))
(defun akmuch-unmark-all ()
(interactive)
(akmuch-tag "-*" t))
(defun akmuch-tag-marked (tags)
(interactive "sTags: ")
(akmuch-tag tags t))
(provide 'akmuch-tag)