]> git.notmuchmail.org Git - notmuch/blob - notmuch.el
8e752198f240cd1e98f8e5c9628a316fdf2877e9
[notmuch] / notmuch.el
1 ; notmuch.el --- run notmuch within emacs
2 ;
3 ; Copyright © Carl Worth
4 ;
5 ; This file is part of Notmuch.
6 ;
7 ; Notmuch is free software: you can redistribute it and/or modify it
8 ; under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
11 ;
12 ; Notmuch is distributed in the hope that it will be useful, but
13 ; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 ; General Public License for more details.
16 ;
17 ; You should have received a copy of the GNU General Public License
18 ; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
19 ;
20 ; Authors: Carl Worth <cworth@cworth.org>
21
22 (defvar notmuch-show-mode-map
23   (let ((map (make-sparse-keymap)))
24     ; I don't actually want all of these toggle commands occupying
25     ; keybindings. They steal valuable key-binding space, are hard
26     ; to remember, and act globally rather than locally.
27     ;
28     ; Will be much preferable to switch to direct manipulation for
29     ; toggling visibility of these components. Probably using
30     ; overlays-at to query and manipulate the current overlay.
31     (define-key map "a" 'notmuch-show-archive-thread)
32     (define-key map "b" 'notmuch-show-toggle-body-read-visible)
33     (define-key map "c" 'notmuch-show-toggle-citations-visible)
34     (define-key map "h" 'notmuch-show-toggle-headers-visible)
35     (define-key map "n" 'notmuch-show-mark-read-then-next-message)
36     (define-key map "p" 'notmuch-show-previous-message)
37     (define-key map "q" 'kill-this-buffer)
38     (define-key map "s" 'notmuch-show-toggle-signatures-visible)
39     (define-key map "x" 'kill-this-buffer)
40     (define-key map "+" 'notmuch-show-add-tag)
41     (define-key map "-" 'notmuch-show-remove-tag)
42     (define-key map " " 'notmuch-show-advance-marking-read-and-archiving)
43     map)
44   "Keymap for \"notmuch show\" buffers.")
45 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
46
47 (defvar notmuch-show-message-begin-regexp    "\fmessage{")
48 (defvar notmuch-show-message-end-regexp      "\fmessage}")
49 (defvar notmuch-show-header-begin-regexp     "\fheader{")
50 (defvar notmuch-show-header-end-regexp       "\fheader}")
51 (defvar notmuch-show-body-begin-regexp       "\fbody{")
52 (defvar notmuch-show-body-end-regexp         "\fbody}")
53 (defvar notmuch-show-attachment-begin-regexp "\fattachment{")
54 (defvar notmuch-show-attachment-end-regexp   "\fattachment}")
55 (defvar notmuch-show-part-begin-regexp       "\fpart{")
56 (defvar notmuch-show-part-end-regexp         "\fpart}")
57 (defvar notmuch-show-marker-regexp "\f\\(message\\|header\\|body\\|attachment\\|part\\)[{}].*$")
58
59 (defvar notmuch-show-id-regexp "ID: \\(.*\\)$")
60 (defvar notmuch-show-tags-regexp "(\\([^)]*\\))$")
61
62 (defun notmuch-show-get-message-id ()
63   (save-excursion
64     (beginning-of-line)
65     (if (not (looking-at notmuch-show-message-begin-regexp))
66         (re-search-backward notmuch-show-message-begin-regexp))
67     (re-search-forward notmuch-show-id-regexp)
68     (buffer-substring (match-beginning 1) (match-end 1))))
69
70 (defun notmuch-show-set-tags (tags)
71   (save-excursion
72     (beginning-of-line)
73     (if (not (looking-at notmuch-show-message-begin-regexp))
74         (re-search-backward notmuch-show-message-begin-regexp))
75     (re-search-forward notmuch-show-tags-regexp)
76     (let ((inhibit-read-only t)
77           (beg (match-beginning 1))
78           (end (match-end 1)))
79       (delete-region beg end)
80       (goto-char beg)
81       (insert (mapconcat 'identity tags " ")))))
82
83 (defun notmuch-show-get-tags ()
84   (save-excursion
85     (beginning-of-line)
86     (if (not (looking-at notmuch-show-message-begin-regexp))
87         (re-search-backward notmuch-show-message-begin-regexp))
88     (re-search-forward notmuch-show-tags-regexp)
89     (split-string (buffer-substring (match-beginning 1) (match-end 1)))))
90
91 (defun notmuch-show-add-tag (tag)
92   (interactive "sTag to add: ")
93   (notmuch-call-notmuch-process "tag" (concat "+" tag) (concat "id:" (notmuch-show-get-message-id)))
94   (notmuch-show-set-tags (delete-dups (sort (cons tag (notmuch-show-get-tags)) 'string<))))
95
96 (defun notmuch-show-remove-tag (tag)
97   (interactive "sTag to remove: ")
98   (let ((tags (notmuch-show-get-tags)))
99     (if (member tag tags)
100         (progn
101           (notmuch-call-notmuch-process "tag" (concat "-" tag) (concat "id:" (notmuch-show-get-message-id)))
102           (notmuch-show-set-tags (delete tag tags))))))
103
104 (defun notmuch-show-archive-thread ()
105   "Archive each message currrently shown by removing the \"inbox\" tag from each.
106
107 This command is safe from any race condition of new messages
108 being delivered to the same thread. It does not archive the
109 entire thread, but only the messages shown in the current
110 buffer."
111   (interactive)
112   (save-excursion
113     (goto-char (point-min))
114     (while (not (eobp))
115       (notmuch-show-remove-tag "inbox")
116       (if (not (eobp))
117           (forward-char))
118       (if (not (re-search-forward notmuch-show-message-begin-regexp nil t))
119           (goto-char (point-max))))))
120
121 (defun notmuch-show-move-to-current-message-summary-line ()
122   "Move to the beginning of the one-line summary of the current message.
123
124 This gives us a stable place to move to and work from since the
125 summary line is always visible. This is important since moving to
126 an invisible location is unreliable, (the main command loop moves
127 point either forward or backward to the next visible character
128 when a command ends with point on an invisible character).
129
130 Emits an error if point is not within a valid message, (that is
131 not pattern of `notmuch-show-message-begin-regexp' could be found
132 by searching backward)."
133   (beginning-of-line)
134   (if (not (looking-at notmuch-show-message-begin-regexp))
135       (if (re-search-backward notmuch-show-message-begin-regexp nil t)
136           (forward-line 2)
137         (error "Not within a valid message."))
138     (forward-line 2)))
139
140 (defun notmuch-show-next-message ()
141   "Advance to the beginning of the next message in the buffer.
142
143 Moves to the beginning of the current message if already on the
144 last message in the buffer."
145   (interactive)
146   (notmuch-show-move-to-current-message-summary-line)
147   (re-search-forward notmuch-show-message-begin-regexp nil t)
148   (notmuch-show-move-to-current-message-summary-line)
149   (recenter 0))
150
151 (defun notmuch-show-find-next-message ()
152   "Returns the position of the next message in the buffer.
153
154 Or the beginning of the current message if already within the last
155 message in the buffer."
156   ; save-excursion doesn't save our window position
157   ; save-window-excursion doesn't save point
158   ; Looks like we have to use both.
159   (save-excursion
160     (save-window-excursion
161       (notmuch-show-next-message)
162       (point))))
163
164 (defun notmuch-show-previous-message ()
165   "Backup to the beginning of the previous message in the buffer.
166
167 If within a message rather than at the beginning of it, then
168 simply move to the beginning of the current message."
169   (interactive)
170   (let ((start (point)))
171     (notmuch-show-move-to-current-message-summary-line)
172     (if (not (< (point) start))
173         ; Go backward twice to skip the current message's marker
174         (progn
175           (re-search-backward notmuch-show-message-begin-regexp nil t)
176           (re-search-backward notmuch-show-message-begin-regexp nil t)
177           (notmuch-show-move-to-current-message-summary-line)
178           ))
179     (recenter 0)))
180
181 (defun notmuch-show-mark-read-then-next-message ()
182   "Remove unread tag from current message, then advance to next message."
183   (interactive)
184   (notmuch-show-remove-tag "unread")
185   (notmuch-show-next-message))
186
187 (defun notmuch-show-advance-marking-read-and-archiving ()
188   "Advance through buffer, marking read and archiving.
189
190 This command is intended to be one of the simplest ways to
191 process a thread of email. It does the following:
192
193 If the current message in the thread is not yet fully visible,
194 scroll by a near screenful to read more of the message.
195
196 Otherwise, (the end of the current message is already within the
197 current window), remove the \"unread\" tag from the current
198 message and advance to the next message.
199
200 Finally, if there is no further message to advance to, and this
201 last message is already read, then archive the entire current
202 thread, (remove the \"inbox\" tag from each message)."
203   (interactive)
204   (let ((next (notmuch-show-find-next-message))
205         (unread (member "unread" (notmuch-show-get-tags))))
206     (if (and (not unread)
207              (equal next (point)))
208         (notmuch-show-archive-thread)
209       (if (< (notmuch-show-find-next-message) (window-end))
210           (notmuch-show-mark-read-then-next-message)
211         (scroll-up nil)))))
212
213 (defun notmuch-show-markup-citations-region (beg end)
214   (goto-char beg)
215   (beginning-of-line)
216   (while (< (point) end)
217     (let ((beg-sub (point)))
218       (if (looking-at ">")
219           (progn
220             (while (looking-at ">")
221               (next-line))
222             (let ((overlay (make-overlay beg-sub (point))))
223               (overlay-put overlay 'invisible 'notmuch-show-citation)
224               (overlay-put overlay 'before-string
225                            (concat "[" (number-to-string (count-lines beg-sub (point)))
226                                    " quoted lines.]")))))
227       (if (looking-at "--[ ]?$")
228           (let ((overlay (make-overlay beg-sub end)))
229             (overlay-put overlay 'invisible 'notmuch-show-signature)
230             (overlay-put overlay 'before-string
231                          (concat "[" (number-to-string (count-lines beg-sub (point)))
232                                  "-line signature.]"))
233             (goto-char end)))
234       (next-line))))
235
236 (defun notmuch-show-markup-body ()
237   (re-search-forward notmuch-show-body-begin-regexp)
238   (next-line 1)
239   (beginning-of-line)
240   (let ((beg (point)))
241     (re-search-forward notmuch-show-body-end-regexp)
242     (let ((end (match-beginning 0)))
243       (notmuch-show-markup-citations-region beg end)
244       (if (not (member "unread" (notmuch-show-get-tags)))
245           (overlay-put (make-overlay beg end)
246                        'invisible 'notmuch-show-body-read)))))
247
248 (defun notmuch-show-markup-header ()
249   (re-search-forward notmuch-show-header-begin-regexp)
250   (next-line 2)
251   (beginning-of-line)
252   (let ((beg (point)))
253     (re-search-forward notmuch-show-header-end-regexp)
254     (overlay-put (make-overlay beg (match-beginning 0))
255                  'invisible 'notmuch-show-header)))
256
257 (defun notmuch-show-markup-message ()
258   (if (re-search-forward notmuch-show-message-begin-regexp nil t)
259       (progn
260         (notmuch-show-markup-header)
261         (notmuch-show-markup-body))
262     (goto-char (point-max))))
263
264 (defun notmuch-show-hide-markers ()
265   (save-excursion
266     (goto-char (point-min))
267     (while (not (eobp))
268       (if (re-search-forward notmuch-show-marker-regexp nil t)
269           (progn
270             (overlay-put (make-overlay (match-beginning 0) (+ (match-end 0) 1))
271                          'invisible 'notmuch-show-marker))
272         (goto-char (point-max))))))
273
274 (defun notmuch-show-markup-messages ()
275   (save-excursion
276     (goto-char (point-min))
277     (while (not (eobp))
278       (notmuch-show-markup-message)))
279   (notmuch-show-hide-markers))
280
281 (defun notmuch-show-toggle-citations-visible ()
282   "Toggle visibility of citations"
283   (interactive)
284   (if notmuch-show-citations-visible
285       (add-to-invisibility-spec 'notmuch-show-citation)
286     (remove-from-invisibility-spec 'notmuch-show-citation))
287   (set 'notmuch-show-citations-visible (not notmuch-show-citations-visible))
288   ; Need to force the redisplay for some reason
289   (force-window-update)
290   (redisplay t))
291
292 (defun notmuch-show-toggle-signatures-visible ()
293   "Toggle visibility of signatures"
294   (interactive)
295   (if notmuch-show-signatures-visible
296       (add-to-invisibility-spec 'notmuch-show-signature)
297     (remove-from-invisibility-spec 'notmuch-show-signature))
298   (set 'notmuch-show-signatures-visible (not notmuch-show-signatures-visible))
299   ; Need to force the redisplay for some reason
300   (force-window-update)
301   (redisplay t))
302
303 (defun notmuch-show-toggle-headers-visible ()
304   "Toggle visibility of header fields"
305   (interactive)
306   (if notmuch-show-headers-visible
307       (add-to-invisibility-spec 'notmuch-show-header)
308     (remove-from-invisibility-spec 'notmuch-show-header))
309   (set 'notmuch-show-headers-visible (not notmuch-show-headers-visible))
310   ; Need to force the redisplay for some reason
311   (force-window-update)
312   (redisplay t))
313
314 (defun notmuch-show-toggle-body-read-visible ()
315   "Toggle visibility of message bodies of read messages"
316   (interactive)
317   (if notmuch-show-body-read-visible
318       (add-to-invisibility-spec 'notmuch-show-body-read)
319     (remove-from-invisibility-spec 'notmuch-show-body-read))
320   (set 'notmuch-show-body-read-visible (not notmuch-show-body-read-visible))
321   ; Need to force the redisplay for some reason
322   (force-window-update)
323   (redisplay t))
324
325 ;;;###autoload
326 (defun notmuch-show-mode ()
327   "Major mode for viewing a thread with notmuch.
328
329 This buffer contains the results of the \"notmuch show\" command
330 for displaying a single thread of email from your email archives.
331
332 By default, various components of email messages, (citations,
333 signatures, already-read messages), are invisible to help you
334 focus on the most important things, (new text from unread
335 messages). See the various commands below for toggling the
336 visibility of hidden components.
337
338 The `notmuch-show-next-message' and
339 `notmuch-show-previous-message' commands, (bound to 'n' and 'p by
340 default), allow you to navigate to the next and previous
341 messages. Each time you navigate away from a message with
342 `notmuch-show-next-message' the current message will have its
343 \"unread\" tag removed.
344
345 You can add or remove tags from the current message with '+' and
346 '-'.  You can also archive all messages in the current
347 view, (remove the \"inbox\" tag from each), with
348 `notmuch-show-archive-thread' (bound to 'a' by default).
349
350 \\{notmuch-show-mode-map}"
351   (interactive)
352   (kill-all-local-variables)
353   (set (make-local-variable 'notmuch-show-headers-visible) t)
354   (notmuch-show-toggle-headers-visible)
355   (set (make-local-variable 'notmuch-show-body-read-visible) t)
356   (notmuch-show-toggle-body-read-visible)
357   (set (make-local-variable 'notmuch-show-citations-visible) t)
358   (notmuch-show-toggle-citations-visible)
359   (set (make-local-variable 'notmuch-show-signatures-visible) t)
360   (notmuch-show-toggle-signatures-visible)
361   (add-to-invisibility-spec 'notmuch-show-marker)
362   (use-local-map notmuch-show-mode-map)
363   (setq major-mode 'notmuch-show-mode
364         mode-name "notmuch-show")
365   (setq buffer-read-only t))
366
367 (defun notmuch-show (thread-id)
368   "Run \"notmuch show\" with the given thread ID and display results."
369   (interactive "sNotmuch show: ")
370   (let ((buffer (get-buffer-create (concat "*notmuch-show-" thread-id "*"))))
371     (switch-to-buffer buffer)
372     (notmuch-show-mode)
373     (let ((proc (get-buffer-process (current-buffer)))
374           (inhibit-read-only t))
375       (if proc
376           (error "notmuch search process already running for query `%s'" query)
377         )
378       (erase-buffer)
379       (goto-char (point-min))
380       (save-excursion
381         (call-process "notmuch" nil t nil "show" thread-id)
382         (notmuch-show-markup-messages)
383         )
384       )))
385
386 (defvar notmuch-search-mode-map
387   (let ((map (make-sparse-keymap)))
388     (define-key map "a" 'notmuch-search-archive-thread)
389     (define-key map "b" 'scroll-down)
390     (define-key map "f" 'notmuch-search-filter)
391     (define-key map "n" 'next-line)
392     (define-key map "p" 'previous-line)
393     (define-key map "q" 'kill-this-buffer)
394     (define-key map "s" 'notmuch-search)
395     (define-key map "t" 'notmuch-search-filter-by-tag)
396     (define-key map "x" 'kill-this-buffer)
397     (define-key map "\r" 'notmuch-search-show-thread)
398     (define-key map "+" 'notmuch-search-add-tag)
399     (define-key map "-" 'notmuch-search-remove-tag)
400     (define-key map "<" 'beginning-of-buffer)
401     (define-key map ">" 'notmuch-search-goto-last-thread)
402     (define-key map "=" 'notmuch-search-refresh-view)
403     (define-key map "\M->" 'notmuch-search-goto-last-thread)
404     (define-key map " " 'scroll-up)
405     (define-key map (kbd "<DEL>") 'scroll-down)
406     map)
407   "Keymap for \"notmuch search\" buffers.")
408 (fset 'notmuch-search-mode-map notmuch-search-mode-map)
409
410 (defun notmuch-search-goto-last-thread (&optional arg)
411   "Move point to the last thread in the buffer."
412   (interactive "^P")
413   (end-of-buffer arg)
414   (beginning-of-line))
415
416 ;;;###autoload
417 (defun notmuch-search-mode ()
418   "Major mode for searching mail with notmuch.
419
420 This buffer contains the results of a \"notmuch search\" of your
421 email archives. Each line in the buffer represents a single
422 thread giving a relative date for the thread and a subject.
423
424 Pressing RET on any line displays that thread. The '+' and '-'
425 keys can be used to add or remove tags from a thread. The 'a' key
426 is a convenience key for archiving a thread (removing the
427 \"inbox\" tag).
428
429 Other useful commands are `notmuch-search-filter' for filtering
430 the current search based on an additional query string,
431 `notmuch-search-filter-by-tag' for filtering to include only
432 messages with a given tag, and `notmuch-search' to execute a new,
433 global search.
434
435 \\{notmuch-search-mode-map}"
436   (interactive)
437   (kill-all-local-variables)
438   (make-local-variable 'notmuch-search-query-string)
439   (set (make-local-variable 'scroll-preserve-screen-position) t)
440   (add-to-invisibility-spec 'notmuch-search)
441   (use-local-map notmuch-search-mode-map)
442   (setq major-mode 'notmuch-search-mode
443         mode-name "notmuch-search")
444   (setq buffer-read-only t))
445
446 (defun notmuch-search-find-thread-id ()
447   (save-excursion
448     (beginning-of-line)
449     (let ((beg (point)))
450       (re-search-forward "[a-fA-F0-9]*")
451       (filter-buffer-substring beg (point)))))
452
453 (defun notmuch-search-markup-this-thread-id ()
454   (beginning-of-line)
455   (let ((beg (point)))
456     (re-search-forward "[a-fA-F0-9]*")
457     (forward-char)
458     (overlay-put (make-overlay beg (point)) 'invisible 'notmuch-search)))
459
460 (defun notmuch-search-markup-thread-ids ()
461   (save-excursion
462     (goto-char (point-min))
463     (while (not (eobp))
464       (notmuch-search-markup-this-thread-id)
465       (next-line))))
466
467 (defun notmuch-search-hide-thread-ids ()
468   (interactive)
469   (add-to-invisibility-spec 'notmuch-search)
470   (force-window-update)
471   (redisplay t))
472
473 (defun notmuch-search-show-thread-ids ()
474   (interactive)
475   (remove-from-invisibility-spec 'notmuch-search)
476   (force-window-update)
477   (redisplay t))
478
479 (defun notmuch-search-show-thread ()
480   (interactive)
481   (notmuch-show (notmuch-search-find-thread-id)))
482
483 (defun notmuch-call-notmuch-process (&rest args)
484   (let ((error-buffer (get-buffer-create "*Notmuch errors*")))
485     (with-current-buffer error-buffer
486         (erase-buffer))
487     (if (eq (apply 'call-process "notmuch" nil error-buffer nil args) 0)
488         (point)
489       (progn
490         (with-current-buffer error-buffer
491           (let ((beg (point-min))
492                 (end (- (point-max) 1)))
493             (error (buffer-substring beg end))
494             ))))))
495
496 (defun notmuch-search-set-tags (tags)
497   (save-excursion
498     (end-of-line)
499     (re-search-backward "(")
500     (forward-char)
501     (let ((beg (point))
502           (inhibit-read-only t))
503       (re-search-forward ")")
504       (backward-char)
505       (let ((end (point)))
506         (delete-region beg end)
507         (insert (mapconcat  'identity tags " "))))))
508
509 (defun notmuch-search-get-tags ()
510   (save-excursion
511     (end-of-line)
512     (re-search-backward "(")
513     (let ((beg (+ (point) 1)))
514       (re-search-forward ")")
515       (let ((end (- (point) 1)))
516         (split-string (buffer-substring beg end))))))
517
518 (defun notmuch-search-add-tag (tag)
519   (interactive "sTag to add: ")
520   (notmuch-call-notmuch-process "tag" (concat "+" tag) (concat "thread:" (notmuch-search-find-thread-id)))
521   (notmuch-search-set-tags (delete-dups (sort (cons tag (notmuch-search-get-tags)) 'string<))))
522
523 (defun notmuch-search-remove-tag (tag)
524   (interactive "sTag to remove: ")
525   (notmuch-call-notmuch-process "tag" (concat "-" tag) (concat "thread:" (notmuch-search-find-thread-id)))
526   (notmuch-search-set-tags (delete tag (notmuch-search-get-tags))))
527
528 (defun notmuch-search-archive-thread ()
529   "Archive the current thread (remove its \"inbox\" tag).
530
531 This function advances point to the next line when finished."
532   (interactive)
533   (notmuch-search-remove-tag "inbox")
534   (next-line))
535
536 (defun notmuch-search (query)
537   "Run \"notmuch search\" with the given query string and display results."
538   (interactive "sNotmuch search: ")
539   (let ((buffer (get-buffer-create (concat "*notmuch-search-" query "*"))))
540     (switch-to-buffer buffer)
541     (notmuch-search-mode)
542     (set 'notmuch-search-query-string query)
543     (let ((proc (get-buffer-process (current-buffer)))
544           (inhibit-read-only t))
545       (if proc
546           (error "notmuch search process already running for query `%s'" query)
547         )
548       (erase-buffer)
549       (goto-char (point-min))
550       (save-excursion
551         (call-process "notmuch" nil t nil "search" query)
552         (notmuch-search-markup-thread-ids)
553         ; A well-behaved program ends its output with a newline, but we
554         ; don't actually want the blank line at the end of the file.
555         (goto-char (point-max))
556         (if (looking-at "^$")
557             (delete-backward-char 1)
558           )
559         ))))
560
561 (defun notmuch-search-refresh-view ()
562   "Refresh the current view.
563
564 Kills the current buffer and runs a new search with the same
565 query string as the current search. If the current thread is in
566 the new search results, then point will be placed on the same
567 thread. Otherwise, point will be moved to attempt to be in the
568 same relative position within the new buffer."
569   (interactive)
570   (let ((here (point))
571         (thread (notmuch-search-find-thread-id))
572         (query notmuch-search-query-string))
573     (kill-this-buffer)
574     (notmuch-search query)
575     (goto-char (point-min))
576     (if (re-search-forward (concat "^" thread) nil t)
577         (beginning-of-line)
578       (goto-char here))))
579
580 (defun notmuch-search-filter (query)
581   "Filter the current search results based on an additional query string.
582
583 Runs a new search matching only messages that match both the
584 current search results AND the additional query string provided."
585   (interactive "sFilter search: ")
586   (notmuch-search (concat notmuch-search-query-string " and " query)))
587
588 (defun notmuch-search-filter-by-tag (tag)
589   "Filter the current search results based on a single tag.
590
591 Runs a new search matching only messages that match both the
592 current search results AND that are tagged with the given tag."
593   (interactive "sFilter by tag: ")
594   (notmuch-search (concat notmuch-search-query-string " and tag:" tag)))
595
596 (defun notmuch ()
597   "Run notmuch to display all mail with tag of 'inbox'"
598   (interactive)
599   (notmuch-search "tag:inbox"))
600
601 (provide 'notmuch)