2017-08-11 18:46:41 +00:00
#+TITLE : Notmuch layer
2019-05-02 21:49:30 +00:00
#+TAGS : e-mail|layer
2018-01-07 04:50:52 +00:00
[[file:img/notmuch.png ]]
2017-08-11 18:46:41 +00:00
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-08-11 18:46:41 +00:00
- [[#description ][Description ]]
- [[#features ][Features: ]]
- [[#install ][Install ]]
2018-01-15 04:12:24 +00:00
- [[#configuration ][Configuration ]]
2017-08-11 18:46:41 +00:00
- [[#sending-and-receiving-emails ][Sending and Receiving emails ]]
- [[#receiving-emails ][Receiving emails ]]
- [[#sending-emails-with-thunderbird ][Sending emails with Thunderbird ]]
- [[#sending-emails-with-msmtp ][Sending emails with msmtp ]]
2018-01-15 04:12:24 +00:00
- [[#tags-to-apply-when-deleting ][Tags to apply when deleting ]]
2018-01-07 04:50:52 +00:00
- [[#see-also ][See also ]]
2017-08-11 18:46:41 +00:00
- [[#key-bindings ][Key bindings ]]
- [[#global-bindings ][Global bindings ]]
- [[#show-mode ][Show mode ]]
2018-01-07 04:50:52 +00:00
- [[#evilified-key-bindings ][Evilified key bindings ]]
- [[#hello-mode ][Hello mode ]]
- [[#search-mode ][Search mode ]]
- [[#show-mode-1 ][Show mode ]]
- [[#tree-mode ][Tree mode ]]
2018-01-07 05:44:50 +00:00
- [[#spacemacs-layout-integration ][Spacemacs layout integration ]]
2017-08-11 18:46:41 +00:00
* Description
Notmuch offers a fast, global-search and tag-based email system to
use within your text editor or in a terminal.
2019-06-01 17:13:30 +00:00
This layer integrates the Notmuch Emacs package into Spacemacs.
2017-08-11 18:46:41 +00:00
** Features:
2018-09-19 03:54:47 +00:00
- Email searching
- Email tagging
2017-08-11 18:46:41 +00:00
* Install
2019-06-01 17:13:30 +00:00
In order to use this layer you must install Notmuch separately.
2017-08-11 18:46:41 +00:00
To install not much follow the instructions in [[https://notmuchmail.org/notmuch-emacs/#index2h2 ][installation instructions ]].
Then add this layer to your =~/.spacemacs= . You will need to add =notmuch= to
the existing =dotspacemacs-configuration-layers= list in this file.
2018-01-15 04:12:24 +00:00
* Configuration
2017-08-11 18:46:41 +00:00
** Sending and Receiving emails
For this you will need an external program.
*** Receiving emails
To be able to receive email you will need to configure an external program to do
it. See the [[https://notmuchmail.org/howto/ ][receive mail ]] section.
After you configured your email fetcher program, maybe you would like to
synchronize the email each time you call =notmuch= , in order to do that you
could customize the variable =notmuch-hello-mode-hook= to call a lisp function
that calls your email syncing utility.
*** Sending emails with Thunderbird
You could use thunderbird
2018-09-19 03:54:47 +00:00
[[http://pragmaticemacs.com/emacs/use-emacs-for-thunderbird-emails/ ]]
2017-08-11 18:46:41 +00:00
*** Sending emails with msmtp
Download and Install [[http://msmtp.sourceforge.net/download.html ][msmtp ]]
Configure =~/.mailrc= with the path where =msmtp= is found.
For example:
2018-09-19 03:54:47 +00:00
#+SRCNAME : contents of ~/.mailrc
2018-07-10 10:57:25 +00:00
2018-02-06 12:23:15 +00:00
#+BEGIN_SRC rc
2018-09-19 03:54:47 +00:00
set sendmail="/usr/local/bin/msmtp"
2017-08-11 18:46:41 +00:00
#+END_SRC
Configure =~/.msmtprc= [[http://msmtp.sourceforge.net/doc/msmtprc.txt ][example ]]
2018-01-15 04:12:24 +00:00
** Tags to apply when deleting
You can specifiy which tags you want to apply when you delete an email by
setting the layer variable =notmuch-message-deleted-tags= .
Default value is to add the =deleted= tag and remove both =inbox= and
=unread= tags.
2018-02-06 12:23:15 +00:00
#+BEGIN_SRC emacs-lisp
2018-09-19 03:54:47 +00:00
(setq-default dotspacemacs-configuration-layers
'((notmuch :variables notmuch-message-deleted-tags '("+deleted" "-inbox" "-unread"))))
2018-01-15 04:12:24 +00:00
#+END_SRC
2018-01-07 04:50:52 +00:00
** See also
Refer to the official notmuch website for more information:
2018-09-19 03:54:47 +00:00
[[https://notmuchmail.org/ ]]
2018-01-07 04:50:52 +00:00
2017-08-11 18:46:41 +00:00
* Key bindings
** Global bindings
2018-10-23 14:18:21 +00:00
| Key binding | Command |
2018-01-07 05:44:50 +00:00
|-------------+----------------------------------------------|
| ~SPC a N N~ | Start notmuch |
2019-12-09 21:44:48 +00:00
| ~SPC a N n~ | Start helm notmuch |
2018-01-07 05:44:50 +00:00
| ~SPC a N j~ | Start a notmuch jump search |
| ~SPC a N s~ | Start a notmuch search |
2019-05-26 20:58:52 +00:00
| ~SPC l o n~ | Start notmuch in a custom layout, "@Notmuch" |
2017-08-11 18:46:41 +00:00
** Show mode
2018-10-23 14:18:21 +00:00
| Key binding | Command |
2017-08-11 18:46:41 +00:00
|-----------------+--------------------------------------------------------------------------------|
| ~SPC m a~ | [ATTACHMENTS] Save all attachments |
|-----------------+--------------------------------------------------------------------------------|
| ~SPC m P o~ | [PATCH] Open github patch in a new buffer |
|-----------------+--------------------------------------------------------------------------------|
| ~SPC m p m~ | [PART] Choose the mime type to use for displaying |
| ~SPC m p \vert~ | [PART] Pipe part at point to an external command |
| ~SPC m p o~ | [PART] View part at point (prompt for a viewer) |
| ~SPC m p v~ | [PART] View part at point in an external viewer |
| ~SPC m p s~ | [PART] Save part at point to a file |
|-----------------+--------------------------------------------------------------------------------|
| ~SPC m s c~ | [STASH] Copy =CC= to kill-ring |
| ~SPC m s d~ | [STASH] Copy =timestamp= to kill-ring |
| ~SPC m s G~ | [STASH] Copy =From/To/Cc/Message-Id= of current message to kill-ring |
| ~SPC m s l~ | [STASH] [Mailing List Archive] Copy =ML Archive URI= to kill-ring |
| ~SPC m s L~ | [STASH] [Mailing List Archive] Copy =ML Archive URI= to kill-ring and visit it |
| ~SPC m s i~ | [STASH] Copy =message-id= to kill-ring |
| ~SPC m s I~ | [STASH] Copy =message-id= without =id:= prefix to kill-ring |
| ~SPC m s f~ | [STASH] Copy =From address= to kill-ring |
| ~SPC m s F~ | [STASH] Copy =filename= to kill-ring |
| ~SPC m s s~ | [STASH] Copy =Subject= to kill-ring |
| ~SPC m s t~ | [STASH] Copy =To address= to kill-ring |
| ~SPC m s T~ | [STASH] Copy =tags= to kill-ring |
2018-01-07 04:50:52 +00:00
** Evilified key bindings
*** Hello mode
2018-10-23 14:18:21 +00:00
| Key binding | Command |
|-------------+-----------------------------|
| ~J~ | Jump to a saved search |
| ~s~ | Show threads matching QUERY |
2018-01-07 04:50:52 +00:00
*** Search mode
2018-10-23 14:18:21 +00:00
| Key binding | Command |
|-------------+--------------------------|
| ~J~ | Jump to saved search |
| ~*~ | [Thread] Add/Remove tags |
| ~+~ | [Message] Add tags |
| ~-~ | [Message] Remove tags |
| ~a~ | [Message] Archive |
2018-01-07 04:50:52 +00:00
*** Show mode
2017-08-11 18:46:41 +00:00
2018-10-23 14:18:21 +00:00
| Key binding | Description |
|-------------+----------------------------|
| ~o~ | Open all messages |
| ~O~ | Close all messages |
| ~n~ | Show next open message |
| ~N~ | Show next message |
| ~p~ | Show previous open message |
| ~P~ | Show previous message |
| ~C-n~ | Show next thread |
| ~C-p~ | Show previous thread |
| ~d~ | Delete messages down |
| ~D~ | Delete messages up |
| ~J~ | Jump search |
| ~L~ | Filter current search |
| ~gf~ | Find file or URL at point |
| ~gg~ | Jump to top |
| ~G~ | Jump to bottom |
| ~gr~ | Refresh buffer |
| ~gR~ | Refresh all buffers |
| ~m~ | Compose mail |
2017-08-11 18:46:41 +00:00
2018-01-07 04:50:52 +00:00
*** Tree mode
2017-08-11 18:46:41 +00:00
2018-10-23 14:18:21 +00:00
| Key binding | Command |
|-------------+--------------------------|
| ~*~ | [Thread] Add/Remove tags |
| ~+~ | [Message] Add tags |
| ~-~ | [Message] Remove tags |
| ~a~ | [Message] Archive |
2018-01-07 05:44:50 +00:00
* Spacemacs layout integration
This layer defines a [[https://github.com/syl20bnr/spacemacs/blob/develop/doc/DOCUMENTATION.org#layouts-and-workspaces ][Spacemacs custom layout ]] and automatically adds notmuch
2018-10-23 14:18:21 +00:00
buffers to this layout. The name and the key binding for the layout can be
2018-01-07 05:44:50 +00:00
customized with the following layer variables:
- =notmuch-spacemacs-layout-name= for the layout name,
- =notmuch-spacemacs-layout-binding= for the key binding.
The following example configures the layout with the default name and binding:
#+BEGIN_SRC emacs-lisp
2018-09-19 03:54:47 +00:00
(setq-default dotspacemacs-configuration-layers '(
(notmuch :variables notmuch-spacemacs-layout-name "@Notmuch"
notmuch-spacemacs-layout-binding "n")))
2018-01-07 05:44:50 +00:00
#+END_SRC