mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-22 11:00:27 +10:00
Updating Doom Emacs.
This commit is contained in:
@@ -12,10 +12,15 @@
|
||||
- [[#arch-linux][Arch Linux]]
|
||||
- [[#nixos][NixOS]]
|
||||
- [[#opensuse][openSUSE]]
|
||||
- [[#debianubuntu][Debian/Ubuntu]]
|
||||
- [[#features][Features]]
|
||||
- [[#configuration][Configuration]]
|
||||
- [[#offlineimap][offlineimap]]
|
||||
- [[#mbsync][mbsync]]
|
||||
- [[#mu-and-mu4e][mu and mu4e]]
|
||||
- [[#troubleshooting][Troubleshooting]]
|
||||
- [[#no-such-file-or-directory-mu4e][=No such file or directory, mu4e=]]
|
||||
- [[#void-function-org-time-add-error-on-gentoo][~(void-function org-time-add)~ error on Gentoo]]
|
||||
|
||||
* Description
|
||||
This module makes Emacs an email client, using ~mu4e~.
|
||||
@@ -33,17 +38,17 @@ via IMAP) and ~mu~ (to index my mail into a format ~mu4e~ can understand).
|
||||
+ ~+gmail~ Enables gmail-specific configuration.
|
||||
|
||||
** Plugins
|
||||
+ [[https://github.com/agpchil/mu4e-maildirs-extension][mu4e-maildirs-extension]]
|
||||
This module install no plugins.
|
||||
|
||||
* Prerequisites
|
||||
This module requires:
|
||||
|
||||
+ Either ~mbsync~ (default) or ~offlineimap~ (to sync mail with)
|
||||
+ ~mu~ (to index your downloaded messages)
|
||||
+ ~mu~, to index your downloaded messages and to provide the ~mu4e~ package.
|
||||
|
||||
** MacOS
|
||||
#+BEGIN_SRC sh
|
||||
brew install mu --with-emacs
|
||||
brew install mu
|
||||
# And one of the following
|
||||
brew install isync # mbsync
|
||||
brew install offlineimap
|
||||
@@ -54,6 +59,7 @@ Run one of the following commands.
|
||||
|
||||
#+BEGIN_SRC sh
|
||||
sudo pacman -S isync # mbsync
|
||||
# OR
|
||||
sudo pacman -S offlineimap
|
||||
#+END_SRC
|
||||
|
||||
@@ -74,7 +80,7 @@ environment.systemPackages = with pkgs; [
|
||||
];
|
||||
#+END_SRC
|
||||
|
||||
[[https://github.com/Emiller88/dotfiles/blob/master/modules/shell/mail.nix][An example of setting up mbsync with home-manager]]
|
||||
[[https://github.com/Emiller88/dotfiles/blob/5eaabedf1b141c80a8d32e1b496055231476f65e/modules/shell/mail.nix][An example of setting up mbsync and mu with home-manager]]
|
||||
|
||||
** openSUSE
|
||||
Remove ~#~ in ~#sync_program=offlineimap~ to choose ~offlineimap~ instead of
|
||||
@@ -84,26 +90,69 @@ Remove ~#~ in ~#sync_program=offlineimap~ to choose ~offlineimap~ instead of
|
||||
sync_program=isync # mbsync
|
||||
#sync_program=offlineimap
|
||||
|
||||
sudo zypper install maildir-utils $sync_programm
|
||||
sudo zypper install maildir-utils $sync_program
|
||||
#+END_SRC
|
||||
|
||||
** Debian/Ubuntu
|
||||
Run the command corresponding to the desired backend and the last one.
|
||||
#+BEGIN_SRC sh
|
||||
sudo apt-get install isync # mbsync
|
||||
# or
|
||||
sudo apt-get install offlineimap
|
||||
# then
|
||||
sudo apt-get install maildir-utils # mu
|
||||
#+END_SRC
|
||||
* TODO Features
|
||||
|
||||
* Configuration
|
||||
** offlineimap
|
||||
This module uses =mbsync= by default. To change this, change ~+mu4e-backend~:
|
||||
This module uses =mbsync= by default. To use =offlineimap=, change ~+mu4e-backend~:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq +mu4e-backend 'offlineimap)
|
||||
#+END_SRC
|
||||
|
||||
Then you must set up offlineimap and index your mail:
|
||||
Next, you need to write a configuration file for =offlineimap=. Mine can be found
|
||||
[[https://github.com/hlissner/dotfiles/blob/be0dce5dae8f3cbafaac0cc44269d84b4a742c46/shell/mu/][in my dotfiles repository]]. It is configured to download mail to ~\~/.mail~. I
|
||||
use [[https://www.passwordstore.org/][unix pass]] to securely store my login credentials. You can find a *very*
|
||||
detailed configuration [[https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf][here]].
|
||||
|
||||
1. Write a ~\~/.offlineimaprc~. Mine can be found [[https://github.com/hlissner/dotfiles/tree/master/shell/mu][in my dotfiles repository]]. It
|
||||
is configured to download mail to ~\~/.mail~. I use [[https://www.passwordstore.org/][unix pass]] to securely
|
||||
store my login credentials.
|
||||
2. Download your email: ~offlineimap -o~ (may take a while)
|
||||
3. Index it with mu: ~mu index --maildir ~/.mail~
|
||||
Next you can download your email with ~offlineimap -o~. This may take a while,
|
||||
especially if you have thousands of mails.
|
||||
|
||||
You can now proceed with the [[#mu-and-mu4e][mu and mu4e]] section.
|
||||
|
||||
** mbsync
|
||||
The steps needed to set up =mu4e= with =mbsync= are very similar to the ones for
|
||||
[[#offlineimap][offlineimap]].
|
||||
|
||||
Start with writing a ~\~/.mbsyncrc~. An example for GMAIL can be found on
|
||||
[[http://pragmaticemacs.com/emacs/migrating-from-offlineimap-to-mbsync-for-mu4e/][pragmaticemacs.com]]. A non-GMAIL example is available as a gist [[https://gist.github.com/agraul/60977cc497c3aec44e10591f94f49ef0][here]]. The [[http://isync.sourceforge.net/mbsync.html][manual
|
||||
page]] contains all needed information to set up your own.
|
||||
|
||||
Next you can download your email with ~mbsync --all~. This may take a while, but
|
||||
should be quicker than =offlineimap= ;).
|
||||
|
||||
You can now proceed with the [[#mu-and-mu4e][mu and mu4e]] section.
|
||||
|
||||
** mu and mu4e
|
||||
You should have your email downloaded already. If you have not, you need to set
|
||||
=offlineimap= or =mbsync= up before you proceed.
|
||||
|
||||
Before you can use =mu4e= or the cli program =mu=, you need to index your email
|
||||
initially. How to do that differs a little depending on the version of =mu= you
|
||||
use. You can check your version with ~mu --version~.
|
||||
|
||||
For =mu= *>=1.4* you need to run two commands:
|
||||
#+BEGIN_SRC sh
|
||||
mu init --maildir ~/.mail --my-address email@example.com
|
||||
mu index
|
||||
#+END_SRC
|
||||
|
||||
=mu= *<1.4* only requires one command:
|
||||
#+BEGIN_SRC sh
|
||||
mu index --maildir ~/.mail
|
||||
#+END_SRC
|
||||
|
||||
Then configure Emacs to use your email address:
|
||||
|
||||
@@ -115,9 +164,20 @@ Then configure Emacs to use your email address:
|
||||
(mu4e-trash-folder . "/Lissner.net/Trash")
|
||||
(mu4e-refile-folder . "/Lissner.net/All Mail")
|
||||
(smtpmail-smtp-user . "henrik@lissner.net")
|
||||
(user-mail-address . "henrik@lissner.net")
|
||||
(user-mail-address . "henrik@lissner.net") ;; only needed for mu < 1.4
|
||||
(mu4e-compose-signature . "---\nHenrik Lissner"))
|
||||
t)
|
||||
#+END_SRC
|
||||
|
||||
** TODO mbsync
|
||||
* Troubleshooting
|
||||
** =No such file or directory, mu4e=
|
||||
You will get =No such file or directory, mu4e= errors if you don't run ~doom
|
||||
sync~ after installing =mu= through your package manager.
|
||||
** ~(void-function org-time-add)~ error on Gentoo
|
||||
Gentoo users will see this error because [[https://gitweb.gentoo.org/repo/gentoo.git/tree/net-mail/mu/files/70mu-gentoo.el#n2][the =net-mail/mu= package eagerly loads
|
||||
=mu4e= (which pulls in =org=) much too early]]; before Emacs reads =~/.emacs.d=.
|
||||
So early, that it loads the built-in version of org-mode, rather than the newer
|
||||
version that Doom installs.
|
||||
|
||||
Later versions of the =net-mail/mu= package have [[https://gitweb.gentoo.org/repo/gentoo.git/commit/net-mail/mu?id=770e1fccb119fbce8ba6d16021a3598123f212ff][fixed this issue]], but you may
|
||||
need to switch to the unstable build of =net-mail/mu= to see it.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
list of cons cells (VARIABLE . VALUE) -- you may want to modify:
|
||||
|
||||
+ `user-full-name' (this or the global `user-full-name' is required)
|
||||
+ `user-mail-address' (required)
|
||||
+ `user-mail-address' (required in mu4e < 1.4)
|
||||
+ `smtpmail-smtp-user' (required for sending mail from Emacs)
|
||||
|
||||
OPTIONAL:
|
||||
@@ -19,8 +19,9 @@ OPTIONAL:
|
||||
DEFAULT-P is a boolean. If non-nil, it marks that email account as the
|
||||
default/fallback account."
|
||||
(after! mu4e
|
||||
(when-let (address (cdr (assq 'user-mail-address letvars)))
|
||||
(add-to-list 'mu4e-user-mail-address-list address))
|
||||
(when (version< mu4e-mu-version "1.4")
|
||||
(when-let (address (cdr (assq 'user-mail-address letvars)))
|
||||
(add-to-list 'mu4e-user-mail-address-list address)))
|
||||
(setq mu4e-contexts
|
||||
(cl-loop for context in mu4e-contexts
|
||||
unless (string= (mu4e-context-name context) label)
|
||||
|
||||
@@ -14,9 +14,13 @@
|
||||
:commands mu4e mu4e-compose-new
|
||||
:init
|
||||
(provide 'html2text) ; disable obsolete package
|
||||
(setq mu4e-maildir "~/.mail"
|
||||
mu4e-attachment-dir "~/.mail/.attachments"
|
||||
mu4e-user-mail-address-list nil)
|
||||
(when (or (not (require 'mu4e-meta nil t))
|
||||
(version< mu4e-mu-version "1.4"))
|
||||
(setq mu4e-maildir "~/.mail"
|
||||
mu4e-user-mail-address-list nil))
|
||||
(setq mu4e-attachment-dir
|
||||
(lambda (&rest _)
|
||||
(expand-file-name ".attachments" (mu4e-root-maildir))))
|
||||
:config
|
||||
(pcase +mu4e-backend
|
||||
(`mbsync
|
||||
@@ -60,11 +64,7 @@
|
||||
(setq mail-user-agent 'mu4e-user-agent)
|
||||
|
||||
;; Use fancy icons
|
||||
(setq mu4e-headers-has-child-prefix '("+" . "")
|
||||
mu4e-headers-empty-parent-prefix '("-" . "")
|
||||
mu4e-headers-first-child-prefix '("\\" . "")
|
||||
mu4e-headers-duplicate-prefix '("=" . "")
|
||||
mu4e-headers-default-prefix '("|" . "")
|
||||
(setq mu4e-use-fancy-chars t
|
||||
mu4e-headers-draft-mark '("D" . "")
|
||||
mu4e-headers-flagged-mark '("F" . "")
|
||||
mu4e-headers-new-mark '("N" . "")
|
||||
@@ -91,23 +91,15 @@
|
||||
(defadvice! +mu4e--refresh-current-view-a (&rest _)
|
||||
:after #'mu4e-mark-execute-all (mu4e-headers-rerun-search))
|
||||
|
||||
(when (featurep! :tools flyspell)
|
||||
(add-hook 'mu4e-compose-mode-hook #'flyspell-mode))
|
||||
|
||||
;; Wrap text in messages
|
||||
(setq-hook! 'mu4e-view-mode-hook truncate-lines nil)
|
||||
|
||||
;; Html mails might be better rendered in a browser
|
||||
(add-to-list 'mu4e-view-actions '("View in browser" . mu4e-action-view-in-browser))
|
||||
|
||||
(when (fboundp 'imagemagick-register-types)
|
||||
(imagemagick-register-types))
|
||||
|
||||
(set-evil-initial-state!
|
||||
'(mu4e-main-mode
|
||||
mu4e-view-mode
|
||||
mu4e-headers-mode
|
||||
mu4e-compose-mode
|
||||
mu4e~update-mail-mode)
|
||||
'normal)
|
||||
|
||||
(map! :localleader
|
||||
:map mu4e-compose-mode-map
|
||||
:desc "send and exit" "s" #'message-send-and-exit
|
||||
@@ -116,23 +108,16 @@
|
||||
:desc "attach" "a" #'mail-add-attachment))
|
||||
|
||||
|
||||
(use-package! mu4e-maildirs-extension
|
||||
:after mu4e
|
||||
:config
|
||||
(mu4e-maildirs-extension)
|
||||
(setq mu4e-maildirs-extension-title nil))
|
||||
|
||||
|
||||
(use-package! org-mu4e
|
||||
:hook (mu4e-compose-mode . org-mu4e-compose-org-mode)
|
||||
:config
|
||||
(setq org-mu4e-link-query-in-headers-mode nil
|
||||
org-mu4e-convert-to-html t)
|
||||
(setq org-mu4e-convert-to-html t)
|
||||
(when (version< mu4e-mu-version "1.4")
|
||||
(setq org-mu4e-link-query-in-headers-mode nil))
|
||||
|
||||
;; Only render to html once. If the first send fails for whatever reason,
|
||||
;; org-mu4e would do so each time you try again.
|
||||
(add-hook! 'message-send-hook
|
||||
(setq-local org-mu4e-convert-to-html nil)))
|
||||
(setq-hook! 'message-send-hook org-mu4e-convert-to-html nil))
|
||||
|
||||
|
||||
;;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; email/mu4e/packages.el
|
||||
|
||||
(package! mu4e-maildirs-extension)
|
||||
|
||||
Reference in New Issue
Block a user