Emacs: Init mu4e

Remove mutt-specific config
master
Pierre Neidhardt 2017-07-19 16:17:24 +01:00
parent 191e9ce28c
commit f69a4b7fb7
4 changed files with 77 additions and 17 deletions

View File

@ -98,7 +98,7 @@
(with-eval-after-load 'emms (require 'init-emms))
;;; Evil
(nconc package-selected-packages '(evil evil-commentary evil-leader evil-ediff evil-magit evil-mc evil-mc-extras linum-relative))
(nconc package-selected-packages '(evil evil-commentary evil-leader evil-ediff evil-magit evil-mc evil-mc-extras linum-relative 'evil-mu4e))
(when (require 'evil nil t) (require 'init-evil))
;;; Eshell
@ -160,21 +160,10 @@
(when (fboundp 'magit-status)
(global-set-key (kbd "C-x g") 'magit-status))
;;; Mail with Mutt support.
(add-hook 'mail-mode-hook 'mail-text)
(defun mutt-backup-buffer ()
"Create a copy of the current buffer.
This is useful for recovery in case Mutt hangs before sending the
e-mail."
(when (not (boundp 'mutt-backup))
(set (make-local-variable 'mutt-backup) (make-temp-file (concat (buffer-name) "-"))))
(copy-file buffer-file-name mutt-backup t))
(defun mutt-edit ()
(mail-mode)
;; Just like magit commits.
(when (require 'with-editor nil t) (with-editor-mode))
(add-hook 'after-save-hook 'mutt-backup-buffer nil t))
(add-to-list 'auto-mode-alist '("/tmp/mutt-.*" . mutt-edit))
;;; Mail
(when (fboundp 'mu4e)
(nconc package-selected-packages '(mu4e-maildirs-extension)))
(with-eval-after-load 'mu4e (require 'init-mu4e))
;;; Makefile
(with-eval-after-load 'make-mode (require 'init-makefile))

View File

@ -547,4 +547,6 @@ The return value is the yanked text."
(evil-range (region-beginning) (region-end) type :expanded t)))
(define-key evil-inner-text-objects-map "m" 'evgeni-inner-defun)
(require 'evil-mu4e)
(provide 'init-evil)

View File

@ -15,7 +15,7 @@
mediawiki-site-alist
'(("Wikipedia" "http://en.wikipedia.org/w/" "Ambrevar" "" "Main Page")
("Wikibooks" "http://en.wikibooks.org/w/" "Ambrevar" "" "LaTeX")
("ArchLinux" "https://wiki.archlinux.org/" "Ambrevar" "" "Mutt")
("ArchLinux" "https://wiki.archlinux.org/" "Ambrevar" "" "Main Page")
("WikEmacs" "https://wikemacs.org/wiki/" "Ambrevar" "" "Main Page")))
(add-hook 'mediawiki-mode-hook 'visual-line-mode)

View File

@ -0,0 +1,69 @@
;;; mu4e
;; TODO: Multi-accounts, see 'contexts'.
;; TODO: Overview of folders and their unread / flagged e-mails. Or simply use filters?
;; TODO: Cross-folder filters?
;; TODO: Is it possible to mbsync without attachments?
;; TODO: Fast reply: do not prompt and always reply to all but myself.
;; TODO: Test PGP.
;; TODO: Try-out BBDB and replace abook. See appendix manual.
;; TODO: How to add attachments? See appendix manual.
;; TODO: Test queued e-mail with smtp-*-queue. See long example in the manual.
(require 'mu4e-maildirs-extension)
(setq
;; Where to save attachments
mu4e-attachment-dir "~/temp"
;; SMTP
message-send-mail-function 'smtpmail-send-it
;; For reporting bugs, "C-x m", etc.
mail-user-agent 'mu4e-user-agent
mu4e-compose-dont-reply-to-self t
;; Display
mu4e-headers-date-format "%F %R"
mu4e-headers-fields '((:human-date . 16)
(:flags . 6)
(:mailing-list . 10)
(:from . 22)
(:subject))
mu4e-headers-time-format "%R"
mu4e-view-show-addresses t
mu4e-view-show-images t
mu4e-view-image-max-width 800
mu4e-hide-index-messages t
;; Unicode chars for decoration might cause issues with some fonts or in terminals.
mu4e-use-fancy-chars t
;; If you're using a dark theme, and the messages are hard to read, it
;; can help to change the luminosity, e.g.:
shr-color-visible-luminance-min 80
;; Gmail-style threading.
mu4e-headers-include-related t ; TODO: Test it.
;; Because default completion can be extended (e.g. Helm, Ivy).
mu4e-completing-read-function 'completing-read
mu4e-headers-sort-direction 'ascending)
;;; Since we sort in ascending diretion, we default to the end of buffer.
(add-hook 'mu4e-headers-found-hook 'end-of-buffer)
;;; Bindings
;;; Is it still useful when Helm is on? What about multiple inboxes?
;; (setq mu4e-maildir-shortcuts '(("/Inbox" . ?i)))
(defun mu4e-add-fortune-signature ()
(require 'functions) ; For `call-process-to-string'.
(setq mu4e-compose-signature
(format "%s\n\n%s"
user-full-name
(call-process-to-string "fortune" "-s"))))
(add-hook 'mu4e-compose-pre-hook 'mu4e-add-fortune-signature)
(provide 'init-mu4e)