about summary refs log tree commit diff stats
path: root/lisp/+notmuch.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/+notmuch.el')
-rw-r--r--lisp/+notmuch.el52
1 files changed, 48 insertions, 4 deletions
diff --git a/lisp/+notmuch.el b/lisp/+notmuch.el index 74b9b77..5df6e5b 100644 --- a/lisp/+notmuch.el +++ b/lisp/+notmuch.el
@@ -60,11 +60,11 @@ for search."
60 'notmuch-address-history))) 60 'notmuch-address-history)))
61 (:else 61 (:else
62 (defun notmuch-address-selection-function (prompt collection initial-input) 62 (defun notmuch-address-selection-function (prompt collection initial-input)
63 "Call (`completing-read' 63 "Call (`completing-read'
64 PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)" 64 PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"
65 (completing-read 65 (completing-read
66 prompt collection nil nil nil 66 prompt collection nil nil nil
67 'notmuch-address-history))))) 67 'notmuch-address-history)))))
68 68
69(defcustom +notmuch-spam-tags '("+spam" "+Spam") 69(defcustom +notmuch-spam-tags '("+spam" "+Spam")
70 "A list of tag changes to apply when marking a thread as spam." 70 "A list of tag changes to apply when marking a thread as spam."
@@ -101,5 +101,49 @@ This function advances the next thread when finished."
101 (when (eq beg end) 101 (when (eq beg end)
102 (notmuch-search-next-thread))) 102 (notmuch-search-next-thread)))
103 103
104(defun +notmuch-tree-beginning (&optional arg)
105 "Move point to beginning of message or tree, depending on ARG."
106 (interactive "P")
107 (cond
108 ((and (window-live-p notmuch-tree-message-window)
109 (not arg))
110 (with-selected-window notmuch-tree-message-window
111 (beginning-of-buffer)))
112 (:else (beginning-of-buffer))))
113
114(defun +notmuch-tree-end (&optional arg)
115 "Move point to end of message or tree, depending on ARG."
116 (interactive "P")
117 (cond
118 ((and (window-live-p notmuch-tree-message-window)
119 (not arg))
120 (with-selected-window notmuch-tree-message-window
121 (end-of-buffer)))
122 (:else (end-of-buffer))))
123
124(defun +notmuch-make-saved-search (name key search-type &rest queries)
125 "Wrapper to ease `notmuch-saved-searches' defining.
126NAME, KEY, and SEARCH-TYPE are paired with the corresponding keywords in
127`notmuch-saved-searches', which see. QUERIES are all concatenated together with
128AND. If QUERIES is prepended with more keyword arguments, those are added to
129the saved search as well."
130 (declare (indent 3))
131 (let (extra-keywords)
132 (while (keywordp (car queries))
133 (push (cadr queries) extra-keywords)
134 (push (car queries) extra-keywords)
135 (setf queries (cddr queries)))
136 (add-to-list 'notmuch-saved-searches
137 (append
138 (list :name name
139 :key key
140 :search-type search-type
141 :query (apply #'+notmuch-query-concat queries))
142 (reverse extra-keywords))
143 :append
144 (lambda (a b)
145 (equal (plist-get a :name)
146 (plist-get b :name))))))
147
104(provide '+notmuch) 148(provide '+notmuch)
105;;; +notmuch.el ends here 149;;; +notmuch.el ends here