3 ==========================
4 Emacs Frontend for Notmuch
5 ==========================
10 This manual covers only the Emacs interface to Notmuch. For information
11 on the command line interface, see section “Description” in the Notmuch
12 Manual Pages. To save typing, we will sometimes use *notmuch* in this
13 manual to refer to the Emacs interface to Notmuch. When this distinction
14 is important, we’ll refer to the Emacs interface as
17 Notmuch-emacs is highly customizable via the the Emacs customization
18 framework (or just by setting the appropriate variables). We try to
19 point out relevant variables in this manual, but in order to avoid
20 duplication of information, you can usually find the most detailed
21 description in the variables' docstring.
30 ``notmuch-hello`` is the main entry point for Notmuch. You can start it
31 with ``M-x notmuch`` or ``M-x notmuch-hello``. The startup screen looks
32 something like the following. There are some hints at the bottom of the
33 screen. There are three main parts to the notmuch-hello screen,
34 discussed below. The **bold** text indicates buttons you can click with
35 a mouse or by positioning the cursor and pressing ``<return>``
37 | Welcome to **notmuch** You have 52 messages.
39 | Saved searches: **[edit]**
41 | 52 **inbox** 52 **unread**
43 | Search: ____________________________________
45 | All tags: **[show]**
47 | Hit \`?' for context-sensitive help in any Notmuch screen.
48 | Customize Notmuch or this page.
50 You can change the overall appearance of the notmuch-hello screen by
51 customizing the variables
53 .. emacsvar:: notmuch-hello-sections
55 |docstring::notmuch-hello-sections|
57 .. emacsvar:: notmuch-hello-thousands-separator
59 |docstring::notmuch-hello-thousands-separator|
61 .. emacsvar:: notmuch-show-logo
63 |docstring::notmuch-show-logo|
65 .. emacsvar:: notmuch-column-control
67 Controls the number of columns for saved searches/tags in notmuch view.
69 This variable has three potential types of values:
73 Automatically calculate the number of columns possible based
74 on the tags to be shown and the window width.
76 .. describe:: integer <n>
78 A lower bound on the number of characters that will
79 be used to display each column.
81 .. describe:: float <f>
83 A fraction of the window width that is the lower bound on the
84 number of characters that should be used for each column.
88 - if you would like two columns of tags, set this to 0.5.
90 - if you would like a single column of tags, set this to 1.0.
92 - if you would like tags to be 30 characters wide, set this to 30.
94 - if you don't want to worry about all of this nonsense, leave
97 .. emacsvar:: notmuch-show-empty-saved-searches
99 |docstring::notmuch-show-empty-saved-searches|
101 notmuch-hello key bindings
102 --------------------------
105 Move to the next widget (button or text entry field)
108 Move to the previous widget.
111 Activate the current widget.
114 Refresh the buffer; mainly update the counts of messages for various
118 Import mail, See :ref:`importing`
124 Search the notmuch database using :ref:`notmuch-search`
127 Print notmuch version
137 Since notmuch is entirely search-based, it's often useful to organize
138 mail around common searches. To facilitate this, the first section of
139 notmuch-hello presents a customizable set of saved searches. Saved
140 searches can also be accessed from anywhere in notmuch by pressing
141 ``j`` to access :ref:`notmuch-jump`.
143 The saved searches default to various common searches such as
144 ``tag:inbox`` to access the inbox and ``tag:unread`` to access all
145 unread mail, but there are several options for customization:
147 .. emacsvar:: notmuch-saved-searches
149 The list of saved searches, including names, queries, and
150 additional per-query options.
152 .. emacsvar:: notmuch-saved-search-sort-function
154 This variable controls how saved searches should be sorted. A value
155 of ``nil`` displays the saved searches in the order they are stored
156 in ‘notmuch-saved-searches’.
161 The search box lets the user enter a Notmuch query. See section
162 “Description” in Notmuch Query Syntax, for more info on Notmuch query
163 syntax. A history of recent searches is also displayed by default. The
164 latter is controlled by the variable `notmuch-hello-recent-searches-max`.
166 .. emacsvar:: notmuch-hello-recent-searches-max
168 |docstring::notmuch-hello-recent-searches-max|
173 One special kind of saved search provided by default is for each
174 individual tag defined in the database. This can be controlled via the
177 .. emacsvar:: notmuch-hello-tag-list-make-query
179 Control how to construct a search (“virtual folder”) from a given
182 .. emacsvar:: notmuch-hello-hide-tags
184 Which tags not to display at all.
191 ``notmuch-search-mode`` is used to display the results from executing
192 a query via ``notmuch-search``. The syntax for these queries is the
193 the same as :ref:`saved-searches`. For details of this syntax see
194 info:notmuch-search-terms
196 By default the output approximates that of the command line See section
197 “Description” in notmuch search command.
199 The main purpose of the ``notmuch-search-mode`` buffer is to act as a
200 menu of results that the user can explore further by pressing
201 ``<return>`` on the appropriate line.
207 Move to previous line
210 Open thread on current line in :ref:`notmuch-show` mode
216 Display full set of key bindings
218 The presentation of results can be controlled by the following
221 .. emacsvar:: notmuch-search-result-format
223 |docstring::notmuch-search-result-format|
225 If the car of an element in notmuch-search-result-format is a
226 function, insert the result of calling the function into the buffer.
228 This allows a user to generate custom fields in the output of a
229 search result. For example, with the following settings, the first
230 few characters on each line of the search result are used to show
231 information about some significant tags associated with the thread.
235 (defun -notmuch-result-flags (format-string result)
236 (let ((tags-to-letters '(("flagged" . "!")
241 (tags (plist-get result :tags)))
242 (format format-string
243 (mapconcat (lambda (t2l)
244 (if (member (car t2l) tags)
247 tags-to-letters ""))))
249 (setq notmuch-search-result-format '((-notmuch-result-flags . "%s ")
252 ("authors" . "%-30s ")
256 See also :emacsvar:`notmuch-tree-result-format`.
258 .. emacsvar:: notmuch-search-oldest-first
260 Display the oldest threads at the top of the buffer
262 It is also possible to customize how the name of buffers containing
263 search results is formatted using the following variables:
265 .. emacsvar:: notmuch-search-buffer-name-format
267 |docstring::notmuch-search-buffer-name-format|
269 .. emacsvar:: notmuch-saved-search-buffer-name-format
271 |docstring::notmuch-saved-search-buffer-name-format|
279 ``notmuch-show-mode`` is used to display a single thread of email from
282 By default, various components of email messages, (citations,
283 signatures, already-read messages), are hidden. You can make
284 these parts visible by clicking with the mouse button or by
285 pressing RET after positioning the cursor on a hidden part.
288 Scroll the current message (if necessary),
289 advance to the next message, or advance to the next thread (if
290 already on the last message of a thread).
299 Move to previous message (or start of current message)
302 Move to next matching message
305 Move to previous matching message
308 Add or remove arbitrary tags from the current message.
311 |docstring::notmuch-show-toggle-elide-non-matching|
314 Display full set of key bindings
316 Display of messages can be controlled by the following variables; see also :ref:`show-large`.
318 .. emacsvar:: notmuch-message-headers
320 |docstring::notmuch-message-headers|
322 .. emacsvar:: notmuch-message-headers-visible
324 |docstring::notmuch-message-headers-visible|
326 .. emacsvar:: notmuch-show-header-line
328 |docstring::notmuch-show-header-line|
330 .. emacsvar:: notmuch-multipart/alternative-discouraged
332 Which mime types to hide by default for multipart messages.
334 Can either be a list of mime types (as strings) or a function
335 mapping a plist representing the current message to such a list.
336 The following example function would discourage `text/html` and
337 `multipart/related` generally, but discourage `text/plain` should
338 the message be sent from `whatever@example.com`.
342 (defun my--determine-discouraged (msg)
343 (let* ((headers (plist-get msg :headers))
344 (from (or (plist-get headers :From) "")))
346 ((string-match "whatever@example.com" from)
349 (list "text/html" "multipart/related")))))
353 Dealing with large messages and threads
354 ---------------------------------------
356 If you are finding :ref:`notmuch-show` is annoyingly slow displaying
357 large messages, you can customize
358 :emacsvar:`notmuch-show-max-text-part-size`. If you want to speed up the
359 display of large threads (with or without large messages), there are
360 several options. First, you can display the same query in one of the
361 other modes. :ref:`notmuch-unthreaded` is the most robust for
362 extremely large queries, but :ref:`notmuch-tree` is also be faster
363 than :ref:`notmuch-show` in general, since it only renders a single
364 message a time. If you prefer to stay with the rendered thread
365 ("conversation") view of :ref:`notmuch-show`, you can customize the
366 variables :emacsvar:`notmuch-show-depth-limit`,
367 :emacsvar:`notmuch-show-height-limit` and
368 :emacsvar:`notmuch-show-max-text-part-size` to limit the amount of
369 rendering done initially. Note that these limits are implicitly
370 *OR*-ed together, and combinations might have surprising effects.
372 .. emacsvar:: notmuch-show-depth-limit
374 |docstring::notmuch-show-depth-limit|
376 .. emacsvar:: notmuch-show-height-limit
378 |docstring::notmuch-show-height-limit|
380 .. emacsvar:: notmuch-show-max-text-part-size
382 |docstring::notmuch-show-max-text-part-size|
389 You can use the usually Emacs ways of copying text to the kill-ring,
390 but notmuch also provides some shortcuts. These keys are available in
391 :ref:`notmuch-show`, and :ref:`notmuch-tree`. A subset are available
392 in :ref:`notmuch-search`.
394 ``c F`` ``notmuch-show-stash-filename``
395 |docstring::notmuch-show-stash-filename|
397 ``c G`` ``notmuch-show-stash-git-send-email``
398 |docstring::notmuch-show-stash-git-send-email|
400 ``c I`` ``notmuch-show-stash-message-id-stripped``
401 |docstring::notmuch-show-stash-message-id-stripped|
403 ``c L`` ``notmuch-show-stash-mlarchive-link-and-go``
404 |docstring::notmuch-show-stash-mlarchive-link-and-go|
406 ``c T`` ``notmuch-show-stash-tags``
407 |docstring::notmuch-show-stash-tags|
409 ``c c`` ``notmuch-show-stash-cc``
410 |docstring::notmuch-show-stash-cc|
412 ``c d`` ``notmuch-show-stash-date``
413 |docstring::notmuch-show-stash-date|
415 ``c f`` ``notmuch-show-stash-from``
416 |docstring::notmuch-show-stash-from|
418 ``c i`` ``notmuch-show-stash-message-id``
419 |docstring::notmuch-show-stash-message-id|
421 ``c l`` ``notmuch-show-stash-mlarchive-link``
422 |docstring::notmuch-show-stash-mlarchive-link|
424 ``c s`` ``notmuch-show-stash-subject``
425 |docstring::notmuch-show-stash-subject|
427 ``c t`` ``notmuch-show-stash-to``
428 |docstring::notmuch-show-stash-to|
431 Show all available copying commands
438 ``notmuch-tree-mode`` displays the results of a "notmuch tree" of your
439 email archives. Each line in the buffer represents a single
440 message giving the relative date, the author, subject, and any
447 Displays that message.
453 Move to previous message
456 Move to next matching message
459 Move to previous matching message
461 ``o`` ``notmuch-tree-toggle-order``
462 |docstring::notmuch-tree-toggle-order|
464 ``l`` ``notmuch-tree-filter``
465 Filter or LIMIT the current search results based on an additional query string
467 ``t`` ``notmuch-tree-filter-by-tag``
468 Filter the current search results based on an additional tag
475 Display full set of key bindings
477 As is the case with :ref:`notmuch-search`, the presentation of results
478 can be controlled by the variable ``notmuch-search-oldest-first``.
480 .. emacsvar:: notmuch-tree-result-format
482 |docstring::notmuch-tree-result-format|
484 The following example shows how to optionally display recipients instead
485 of authors for sent mail (assuming the user is named Mustermann).
489 (defun -notmuch-authors-or-to (format-string result)
490 (let* ((headers (plist-get result :headers))
491 (to (plist-get headers :To))
492 (author (plist-get headers :From))
493 (face (if (plist-get result :match)
494 'notmuch-tree-match-author-face
495 'notmuch-tree-no-match-author-face)))
497 (format format-string
498 (if (string-match "Mustermann" author)
499 (concat "To:" (notmuch-tree-clean-address to))
503 (setq notmuch-tree-result-format
505 (-notmuch-authors-or-to . "%-20.20s")
511 See also :emacsvar:`notmuch-search-result-format`.
513 .. _notmuch-unthreaded:
518 ``notmuch-unthreaded-mode`` is similar to :any:`notmuch-tree` in that
519 each line corresponds to a single message, but no thread information
522 Keybindings are the same as :any:`notmuch-tree`.
527 Several features are accessible from most places in notmuch through the
528 following key bindings:
531 Jump to saved searches using :ref:`notmuch-jump`.
534 Tagging operations using :ref:`notmuch-tag-jump`
536 ``C-_`` ``C-/`` ``C-x u``: Undo previous tagging operation using :ref:`notmuch-tag-undo`
543 Saved searches configured through :ref:`saved-searches` can
544 include a "shortcut key" that's accessible through notmuch-jump.
545 Pressing ``j`` anywhere in notmuch followed by the configured shortcut
546 key of a saved search will immediately jump to that saved search. For
547 example, in the default configuration ``j i`` jumps immediately to the
548 inbox search. When you press ``j``, notmuch-jump shows the saved
549 searches and their shortcut keys in the mini-buffer.
551 .. _notmuch-tag-jump:
556 Tagging operations configured through ``notmuch-tagging-keys`` can
557 be accessed via :kbd:`k` in :ref:`notmuch-show`,
558 :ref:`notmuch-search` and :ref:`notmuch-tree`. With a
559 prefix (:kbd:`C-u k`), notmuch displays a menu of the reverses of the
560 operations specified in ``notmuch-tagging-keys``; i.e. each
561 ``+tag`` is replaced by ``-tag`` and vice versa.
563 .. emacsvar:: notmuch-tagging-keys
565 |docstring::notmuch-tagging-keys|
567 .. _notmuch-tag-undo:
572 Each notmuch buffer supporting tagging operations (i.e buffers in
573 :any:`notmuch-show`, :any:`notmuch-search`, :any:`notmuch-tree`, and
574 :any:`notmuch-unthreaded` mode) keeps a local stack of tagging
575 operations. These can be undone via :emacscmd:`notmuch-tag-undo`. By default
576 this is bound to the usual Emacs keys for undo.
578 .. emacscmd:: notmuch-tag-undo
580 |docstring::notmuch-tag-undo|
585 .. emacscmd:: notmuch-cycle-notmuch-buffers
587 |docstring::notmuch-cycle-notmuch-buffers|
597 .. emacscmd:: notmuch-poll
599 |docstring::notmuch-poll|
601 .. emacsvar:: notmuch-poll-script
603 |docstring::notmuch-poll-script|
608 .. emacsvar:: mail-user-agent
610 Emacs consults the variable :code:`mail-user-agent` to choose a mail
611 sending package for commands like :code:`report-emacs-bug` and
612 :code:`compose-mail`. To use ``notmuch`` for this, customize this
613 variable to the symbol :code:`notmuch-user-agent`.
615 .. emacsvar:: message-dont-reply-to-names
617 When composing mail replies, Emacs's message mode uses the
618 variable :code:`message-dont-reply-to-names` to exclude
619 recipients matching a given collection of regular expressions
620 or satisfying an arbitrary predicate. Notmuch's MUA inherits
621 this standard mechanism and will honour your customization of
627 When Notmuch is loaded, it will read the ``notmuch-init-file``
628 (``~/.emacs.d/notmuch-config`` by default) file. This is normal Emacs Lisp
629 file and can be used to avoid cluttering your ``~/.emacs`` with Notmuch
630 stuff. If the file with ``.elc``, ``.elc.gz``, ``.el`` or ``.el.gz``
631 suffix exist it will be read instead (just one of these, chosen in this
632 order). Most often users create ``~/.emacs.d/notmuch-config.el`` and just
633 work with it. If Emacs was invoked with the ``-q`` or ``--no-init-file``
634 options, ``notmuch-init-file`` is not read.