2015-11-11 20:45:30 +00:00
|
|
|
;;; packages.el --- mu4e Layer packages File for Spacemacs
|
2015-08-02 05:30:30 +00:00
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-08-02 05:30:30 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-11-11 20:45:30 +00:00
|
|
|
(setq mu4e-packages
|
2016-01-12 03:25:03 +00:00
|
|
|
'(
|
2016-02-21 04:05:36 +00:00
|
|
|
(mu4e :location site)
|
2016-01-30 01:56:33 +00:00
|
|
|
mu4e-alert
|
2016-01-12 04:20:20 +00:00
|
|
|
mu4e-maildirs-extension
|
2018-01-20 04:31:06 +00:00
|
|
|
(helm-mu :requires helm)
|
2016-01-12 04:20:20 +00:00
|
|
|
org
|
2017-04-29 17:30:07 +00:00
|
|
|
persp-mode
|
2018-01-08 07:53:13 +00:00
|
|
|
window-purpose
|
2016-01-12 04:20:20 +00:00
|
|
|
))
|
2015-08-02 05:30:30 +00:00
|
|
|
|
2017-04-29 17:30:07 +00:00
|
|
|
(defun mu4e/post-init-persp-mode ()
|
|
|
|
(spacemacs|define-custom-layout mu4e-spacemacs-layout-name
|
|
|
|
:binding mu4e-spacemacs-layout-binding
|
|
|
|
:body
|
|
|
|
(progn
|
|
|
|
(defun spacemacs-layouts/add-mu4e-buffer-to-persp ()
|
|
|
|
(persp-add-buffer (current-buffer)
|
|
|
|
(persp-get-by-name
|
|
|
|
mu4e-spacemacs-layout-name)))
|
2018-01-20 04:29:10 +00:00
|
|
|
(spacemacs/add-to-hooks 'spacemacs-layouts/add-mu4e-buffer-to-persp
|
|
|
|
'(mu4e-main-mode-hook
|
|
|
|
mu4e-headers-mode-hook
|
|
|
|
mu4e-view-mode-hook
|
|
|
|
mu4e-compose-mode-hook))
|
2017-04-29 17:30:07 +00:00
|
|
|
(call-interactively 'mu4e)
|
2018-08-25 22:20:15 +00:00
|
|
|
(call-interactively 'mu4e-update-index)
|
|
|
|
|
|
|
|
(define-advice mu4e~stop (:after nil kill-mu4e-layout-after-mu4e~stop)
|
|
|
|
(when mu4e-spacemacs-kill-layout-on-exit
|
|
|
|
(persp-kill mu4e-spacemacs-layout-name))))))
|
2017-04-29 17:30:07 +00:00
|
|
|
|
2015-08-02 05:30:30 +00:00
|
|
|
(defun mu4e/init-mu4e ()
|
|
|
|
(use-package mu4e
|
2015-11-11 20:45:30 +00:00
|
|
|
:commands (mu4e mu4e-compose-new)
|
2015-08-02 05:30:30 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2018-01-20 04:31:06 +00:00
|
|
|
(spacemacs/set-leader-keys "a M" 'mu4e)
|
2016-02-02 15:50:27 +00:00
|
|
|
(global-set-key (kbd "C-x m") 'mu4e-compose-new)
|
|
|
|
(setq mu4e-completing-read-function 'completing-read
|
|
|
|
mu4e-use-fancy-chars 't
|
|
|
|
mu4e-view-show-images 't
|
|
|
|
message-kill-buffer-on-exit 't)
|
|
|
|
(let ((dir "~/Downloads"))
|
|
|
|
(when (file-directory-p dir)
|
|
|
|
(setq mu4e-attachment-dir dir))))
|
|
|
|
|
2015-08-02 05:30:30 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2018-01-20 04:57:28 +00:00
|
|
|
(evilified-state-evilify-map mu4e-main-mode-map
|
|
|
|
:mode mu4e-main-mode
|
|
|
|
:bindings
|
2018-02-09 08:37:42 +00:00
|
|
|
(kbd "j") 'mu4e~headers-jump-to-maildir
|
|
|
|
(kbd "C-j") 'next-line
|
|
|
|
(kbd "C-k") 'previous-line)
|
2018-01-20 04:57:28 +00:00
|
|
|
|
|
|
|
(evilified-state-evilify-map
|
|
|
|
mu4e-headers-mode-map
|
|
|
|
:mode mu4e-headers-mode
|
|
|
|
:bindings
|
|
|
|
(kbd "C-j") 'mu4e-headers-next
|
|
|
|
(kbd "C-k") 'mu4e-headers-prev
|
|
|
|
(kbd "J") (lambda ()
|
|
|
|
(interactive)
|
|
|
|
(mu4e-headers-mark-thread nil '(read))))
|
|
|
|
|
|
|
|
(evilified-state-evilify-map
|
|
|
|
mu4e-view-mode-map
|
|
|
|
:mode mu4e-view-mode
|
|
|
|
:bindings
|
|
|
|
(kbd "C-j") 'mu4e-view-headers-next
|
|
|
|
(kbd "C-k") 'mu4e-view-headers-prev
|
|
|
|
(kbd "J") (lambda ()
|
|
|
|
(interactive)
|
2018-11-29 09:19:45 +00:00
|
|
|
(mu4e-view-mark-thread '(read)))
|
|
|
|
(kbd "gu") 'mu4e-view-go-to-url)
|
2018-01-20 04:57:28 +00:00
|
|
|
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'mu4e-compose-mode
|
|
|
|
dotspacemacs-major-mode-leader-key 'message-send-and-exit
|
|
|
|
"c" 'message-send-and-exit
|
|
|
|
"k" 'message-kill-buffer
|
|
|
|
"a" 'message-kill-buffer
|
|
|
|
"s" 'message-dont-send ; saves as draft
|
|
|
|
"f" 'mml-attach-file)
|
|
|
|
|
2016-02-02 15:50:27 +00:00
|
|
|
(when mu4e-enable-async-operations
|
|
|
|
(require 'smtpmail-async)
|
|
|
|
(setq send-mail-function 'async-smtpmail-send-it
|
|
|
|
message-send-mail-function 'async-smtpmail-send-it))
|
|
|
|
|
|
|
|
(when (fboundp 'imagemagick-register-types)
|
|
|
|
(imagemagick-register-types))
|
2015-08-02 05:30:30 +00:00
|
|
|
|
|
|
|
(add-to-list 'mu4e-view-actions
|
2016-02-02 15:50:27 +00:00
|
|
|
'("View in browser" . mu4e-action-view-in-browser) t)
|
|
|
|
|
|
|
|
(add-hook 'mu4e-compose-mode-hook
|
2018-01-20 05:05:00 +00:00
|
|
|
(lambda () (use-hard-newlines t 'guess)))
|
|
|
|
|
|
|
|
;; from http://www.djcbsoftware.nl/code/mu/mu4e/Attaching-files-with-dired.html
|
|
|
|
(require 'gnus-dired)
|
|
|
|
;; make the `gnus-dired-mail-buffers' function also work on
|
|
|
|
;; message-mode derived modes, such as mu4e-compose-mode
|
|
|
|
(defun gnus-dired-mail-buffers ()
|
|
|
|
"Return a list of active message buffers."
|
|
|
|
(let (buffers)
|
|
|
|
(save-current-buffer
|
|
|
|
(dolist (buffer (buffer-list t))
|
|
|
|
(set-buffer buffer)
|
|
|
|
(when (and (derived-mode-p 'message-mode)
|
|
|
|
(null message-sent-message-via))
|
|
|
|
(push (buffer-name buffer) buffers))))
|
|
|
|
(nreverse buffers)))
|
|
|
|
(setq gnus-dired-mail-mode 'mu4e-user-agent)
|
|
|
|
(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode))))
|
2016-01-05 17:45:57 +00:00
|
|
|
|
2016-01-30 01:56:33 +00:00
|
|
|
(defun mu4e/init-mu4e-alert ()
|
|
|
|
(use-package mu4e-alert
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-02-14 16:20:14 +00:00
|
|
|
:init (with-eval-after-load 'mu4e
|
|
|
|
(when mu4e-enable-notifications
|
|
|
|
(mu4e-alert-enable-notifications))
|
|
|
|
(when mu4e-enable-mode-line
|
|
|
|
(mu4e-alert-enable-mode-line-display)))))
|
2016-01-30 01:56:33 +00:00
|
|
|
|
2016-01-21 15:17:17 +00:00
|
|
|
(defun mu4e/init-helm-mu ()
|
2018-01-20 04:31:06 +00:00
|
|
|
(use-package helm-mu
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2018-01-22 06:50:03 +00:00
|
|
|
:init (dolist (m mu4e-modes)
|
2018-01-20 04:31:06 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode m
|
|
|
|
"S" 'helm-mu
|
|
|
|
"/" 'helm-mu
|
|
|
|
"C" 'helm-mu-contacts))))
|
2016-01-21 15:17:17 +00:00
|
|
|
|
2016-01-05 17:45:57 +00:00
|
|
|
(defun mu4e/init-mu4e-maildirs-extension ()
|
2017-09-14 20:25:43 +00:00
|
|
|
"If mu4e-use-maildirs-extension is non-nil, set
|
|
|
|
mu4e-use-maildirs-extension-load to be evaluated after mu4e has been loaded."
|
2016-01-05 17:45:57 +00:00
|
|
|
(use-package mu4e-maildirs-extension
|
2017-09-14 20:25:43 +00:00
|
|
|
:if mu4e-use-maildirs-extension
|
2016-01-09 03:34:52 +00:00
|
|
|
:init (with-eval-after-load 'mu4e (mu4e-maildirs-extension-load))))
|
2016-01-12 04:20:20 +00:00
|
|
|
|
2017-08-28 17:34:15 +00:00
|
|
|
(defun mu4e/pre-init-org ()
|
2020-05-24 20:50:41 +00:00
|
|
|
;; load mu4e-org when org is actually loaded
|
2020-06-09 00:06:14 +00:00
|
|
|
(with-eval-after-load 'org
|
|
|
|
(require 'mu4e nil 'noerror)
|
|
|
|
(require 'mu4e-org nil 'noerror)))
|
2018-01-08 07:53:13 +00:00
|
|
|
|
|
|
|
(defun mu4e/pre-init-window-purpose ()
|
|
|
|
(spacemacs|use-package-add-hook window-purpose
|
|
|
|
:pre-config
|
2020-02-28 23:02:17 +00:00
|
|
|
(dolist (mode mu4e-list-modes)
|
|
|
|
(add-to-list 'purpose-user-mode-purposes (cons mode 'mail)))
|
|
|
|
(dolist (mode mu4e-view-modes)
|
|
|
|
(add-to-list 'purpose-user-mode-purposes (cons mode 'mail-view)))))
|