2015-12-02 14:23:39 +00:00
|
|
|
|
#+TITLE: Mu4e layer
|
2016-03-31 02:59:55 +00:00
|
|
|
|
|
|
|
|
|
* Table of Contents :TOC_4_gh:noexport:
|
|
|
|
|
- [[#install][Install]]
|
|
|
|
|
- [[#commands][Commands]]
|
|
|
|
|
- [[#global-bindings][Global bindings]]
|
|
|
|
|
- [[#headers-mode][Headers mode]]
|
|
|
|
|
- [[#view-mode][View mode]]
|
|
|
|
|
- [[#configuration][Configuration]]
|
|
|
|
|
- [[#maildirs-extension][Maildirs extension]]
|
|
|
|
|
- [[#multiple-accounts][Multiple Accounts]]
|
|
|
|
|
- [[#example-configuration][Example configuration]]
|
|
|
|
|
- [[#notifications][Notifications]]
|
|
|
|
|
- [[#os-notifications][OS notifications]]
|
|
|
|
|
- [[#mode-line-notifications][Mode-line notifications]]
|
|
|
|
|
- [[#see-also][See also]]
|
2015-08-02 05:30:30 +00:00
|
|
|
|
|
2016-01-06 05:21:55 +00:00
|
|
|
|
* Install
|
2015-11-11 20:45:30 +00:00
|
|
|
|
In order to use this layer you must install mu and mu4e separately. Typically
|
|
|
|
|
mu4e will be bundled with mu (this is the case on many Linux distributions).
|
2015-08-02 05:30:30 +00:00
|
|
|
|
|
2016-07-25 17:46:24 +00:00
|
|
|
|
If you're on OS X and install mu using Homebrew, you must specify the
|
|
|
|
|
location of your Emacs binary at install time using the EMACS environment
|
|
|
|
|
variable, as well as passing the --with-emacs option:
|
|
|
|
|
|
|
|
|
|
#+begin_src shell
|
|
|
|
|
brew install mu --with-emacs
|
|
|
|
|
#+end_src
|
|
|
|
|
|
2015-11-11 20:45:30 +00:00
|
|
|
|
If the installation directory of mu4e is not in Emacs’ load path, you can set
|
|
|
|
|
the layer variable =mu4e-installation-path=, for example:
|
2015-08-02 05:30:30 +00:00
|
|
|
|
|
2015-11-11 20:45:30 +00:00
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
|
(setq-default dotspacemacs-configuration-layers
|
|
|
|
|
'((mu4e :variables
|
|
|
|
|
mu4e-installation-path "/usr/share/emacs/site-lisp")))
|
|
|
|
|
#+end_src
|
|
|
|
|
|
2016-01-08 20:13:02 +00:00
|
|
|
|
Then add this layer to your =~/.spacemacs=. You will need to add =mu4e= to the
|
|
|
|
|
existing =dotspacemacs-configuration-layers= list in this file.
|
2016-01-06 05:21:55 +00:00
|
|
|
|
|
2015-11-11 20:45:30 +00:00
|
|
|
|
* Commands
|
2015-08-02 05:30:30 +00:00
|
|
|
|
|
2015-11-23 06:55:56 +00:00
|
|
|
|
** Global bindings
|
|
|
|
|
|
2015-08-02 05:30:30 +00:00
|
|
|
|
| Keybinding | Command |
|
|
|
|
|
|------------+------------|
|
2016-11-23 16:23:40 +00:00
|
|
|
|
| ~SPC a M~ | Start mu4e |
|
2015-08-02 05:30:30 +00:00
|
|
|
|
|
2015-11-23 06:55:56 +00:00
|
|
|
|
** Headers mode
|
|
|
|
|
|
|
|
|
|
| Keybinding | Command |
|
|
|
|
|
|------------+-------------------------------------------------------------|
|
2016-11-23 16:23:40 +00:00
|
|
|
|
| ~J~ | Go to next unread thread marking other mail read on the way |
|
|
|
|
|
| ~C-j~ | Next header |
|
|
|
|
|
| ~C-k~ | Previous header |
|
2015-11-23 06:55:56 +00:00
|
|
|
|
|
|
|
|
|
** View mode
|
|
|
|
|
|
|
|
|
|
| Keybinding | Command |
|
|
|
|
|
|------------+-------------------------------------------------------------|
|
2016-11-23 16:23:40 +00:00
|
|
|
|
| ~J~ | Go to next unread thread marking other mail read on the way |
|
|
|
|
|
| ~C-j~ | Next header |
|
|
|
|
|
| ~C-k~ | Previous header |
|
2015-11-23 06:55:56 +00:00
|
|
|
|
|
2015-11-11 20:45:30 +00:00
|
|
|
|
* Configuration
|
2015-08-02 05:30:30 +00:00
|
|
|
|
Configuration varies too much to give precise instructions. What follows is one
|
|
|
|
|
example configuration. Refer to mu4e's manual for more detailed configuration
|
|
|
|
|
instructions.
|
|
|
|
|
|
2016-01-05 17:45:57 +00:00
|
|
|
|
** Maildirs extension
|
|
|
|
|
The maildirs extension adds a list of all your maildirs to the main mu4e view
|
|
|
|
|
that by default shows the unread and total mail counts for all your mail under
|
|
|
|
|
your base mail directory.
|
|
|
|
|
|
2016-01-09 03:33:26 +00:00
|
|
|
|
This extension is enabled by default, you can deactivate (and uninstall) it by
|
|
|
|
|
adding the package == to your dotfile variable =dotspacemacs-excluded-packages=.
|
2016-01-05 17:45:57 +00:00
|
|
|
|
|
2015-11-13 09:03:25 +00:00
|
|
|
|
** Multiple Accounts
|
|
|
|
|
This layer includes support for multiple sending accounts.
|
|
|
|
|
If you have only one account you do not need to define this variable.
|
2016-01-09 20:52:40 +00:00
|
|
|
|
If you have multiple accounts, configure the =mu4e-account-alist= variable:
|
2015-08-02 05:30:30 +00:00
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
(setq mu4e-account-alist
|
|
|
|
|
'(("gmail"
|
|
|
|
|
;; Under each account, set the account-specific variables you want.
|
|
|
|
|
(mu4e-sent-messages-behavior delete)
|
|
|
|
|
(mu4e-sent-folder "/gmail/[Gmail]/.Sent Mail")
|
|
|
|
|
(mu4e-drafts-folder "/gmail/[Gmail]/.Drafts")
|
|
|
|
|
(user-mail-address "billy@gmail.com")
|
|
|
|
|
(user-full-name "Billy"))
|
|
|
|
|
("college"
|
|
|
|
|
(mu4e-sent-messages-behavior sent)
|
|
|
|
|
(mu4e-sent-folder "/college/Sent Items")
|
|
|
|
|
(mu4e-drafts-folder "/college/Drafts")
|
|
|
|
|
(user-mail-address "bb15@college.edu")
|
|
|
|
|
(user-full-name "Billy Bob 15"))))
|
|
|
|
|
(mu4e/mail-account-reset)
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
|
|
The first account listed will be the default account, so variables like
|
2016-01-09 20:52:40 +00:00
|
|
|
|
=user-full-name=, which is used by other parts of Emacs, will have their value
|
2015-08-02 05:30:30 +00:00
|
|
|
|
reset for the default account after sending each email.
|
|
|
|
|
|
2016-01-19 16:06:34 +00:00
|
|
|
|
Note that the mu4e layer expects =mu4e-account-alist= to be defined before the
|
|
|
|
|
layer is loaded. For example, you can set =mu4e-account-alist= to a dummy
|
|
|
|
|
setting in =dotspacemacs/layers=:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
(mu4e :variables mu4e-account-alist t)
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
|
|
and then actually set =mu4e-account-alist= later in =dotspacemacs/user-config=.
|
|
|
|
|
|
2016-01-09 20:52:40 +00:00
|
|
|
|
Make sure you call =mu4e/mail-account-reset= afterward, which will initialize
|
2015-08-02 05:30:30 +00:00
|
|
|
|
the given account variables.
|
|
|
|
|
|
2016-01-31 08:20:05 +00:00
|
|
|
|
If you have mu 0.9.16 or later, you can use mu4e's built-in contexts feature
|
2016-02-07 13:43:41 +00:00
|
|
|
|
instead (see [[http://www.djcbsoftware.nl/code/mu/mu4e/Contexts.html#Contexts][mu4e's manual]]).
|
2016-01-31 08:20:05 +00:00
|
|
|
|
|
2015-11-11 20:45:30 +00:00
|
|
|
|
** Example configuration
|
2015-08-02 05:30:30 +00:00
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
;;; Set up some common mu4e variables
|
|
|
|
|
(setq mu4e-maildir "~/.mail"
|
|
|
|
|
mu4e-trash-folder "/Trash"
|
|
|
|
|
mu4e-refile-folder "/Archive"
|
|
|
|
|
mu4e-get-mail-command "mbsync -a"
|
|
|
|
|
mu4e-update-interval nil
|
|
|
|
|
mu4e-compose-signature-auto-include nil
|
|
|
|
|
mu4e-view-show-images t
|
|
|
|
|
mu4e-view-show-addresses t)
|
|
|
|
|
|
|
|
|
|
;;; Mail directory shortcuts
|
|
|
|
|
(setq mu4e-maildir-shortcuts
|
|
|
|
|
'(("/gmail/INBOX" . ?g)
|
|
|
|
|
("/college/INBOX" . ?c)))
|
|
|
|
|
|
|
|
|
|
;;; Bookmarks
|
|
|
|
|
(setq mu4e-bookmarks
|
|
|
|
|
`(("flag:unread AND NOT flag:trashed" "Unread messages" ?u)
|
|
|
|
|
("date:today..now" "Today's messages" ?t)
|
|
|
|
|
("date:7d..now" "Last 7 days" ?w)
|
|
|
|
|
("mime:image/*" "Messages with images" ?p)
|
|
|
|
|
(,(mapconcat 'identity
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (maildir)
|
|
|
|
|
(concat "maildir:" (car maildir)))
|
|
|
|
|
mu4e-maildir-shortcuts) " OR ")
|
|
|
|
|
"All inboxes" ?i)))
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2016-01-30 01:56:33 +00:00
|
|
|
|
** Notifications
|
|
|
|
|
~mu4e-alert~ is an extension that provides desktop notifications and adds the
|
|
|
|
|
count of unread messages to the modeline.
|
|
|
|
|
|
|
|
|
|
[[https://raw.githubusercontent.com/iqbalansari/mu4e-alert/master/screenshots/mu4e-alert-in-action.png]]
|
|
|
|
|
|
2016-02-14 16:20:14 +00:00
|
|
|
|
For an extended documentation of the available customizations please refer to
|
|
|
|
|
[[https://github.com/iqbalansari/mu4e-alert#customizations][mu4e-alert's documentation]]
|
|
|
|
|
|
|
|
|
|
*** OS notifications
|
2016-01-30 01:56:33 +00:00
|
|
|
|
To enable notifications about new messages, add the following line to your
|
|
|
|
|
~dotspacemacs/user-config~:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
(setq mu4e-enable-notifications t)
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2016-02-14 16:20:14 +00:00
|
|
|
|
or use layer variables when you add the layer to
|
|
|
|
|
=dotspacemacs-configuration-layers=:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
(mu4e :variables mu4e-enable-notifications t)
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2016-01-30 01:56:33 +00:00
|
|
|
|
By default, notifications will be shown in the ~*Messages*~ buffer. To enable
|
|
|
|
|
desktop notifications about new messages, add the following lines to
|
|
|
|
|
your ~dotspacemacs/user-config~, according to your operating system and the
|
|
|
|
|
installed libraries:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
(with-eval-after-load 'mu4e-alert
|
|
|
|
|
;; Enable Desktop notifications
|
|
|
|
|
(mu4e-alert-set-default-style 'notifications)) ; For linux
|
|
|
|
|
;; (mu4e-alert-set-default-style 'libnotify)) ; Alternative for linux
|
|
|
|
|
;; (mu4e-alert-set-default-style 'notifier)) ; For Mac OSX (through the
|
|
|
|
|
; terminal notifier app)
|
|
|
|
|
;; (mu4e-alert-set-default-style 'growl)) ; Alternative for Mac OSX
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2016-02-14 16:20:14 +00:00
|
|
|
|
*** Mode-line notifications
|
|
|
|
|
To enable mode-line display about new messages, add the following line to
|
2016-01-30 01:56:33 +00:00
|
|
|
|
your ~dotspacemacs/user-config~:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
(setq mu4e-enable-mode-line t)
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2016-02-14 16:20:14 +00:00
|
|
|
|
or use layer variables when you add the layer to
|
|
|
|
|
=dotspacemacs-configuration-layers=:
|
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
(mu4e :variables mu4e-enable-mode-line t)
|
|
|
|
|
#+END_SRC
|
2016-01-30 01:56:33 +00:00
|
|
|
|
|
2015-11-11 20:45:30 +00:00
|
|
|
|
* See also
|
2015-08-02 05:30:30 +00:00
|
|
|
|
Refer to the official mu and mu4e documentation for additional info.
|
|
|
|
|
|
|
|
|
|
- [[http://www.djcbsoftware.nl/code/mu/mu4e/index.html][mu4e Manual]]
|