ENH update for mu 1.4+

This commit is contained in:
Nathan Dwarshuis 2020-04-28 17:37:17 -04:00
parent 9e6a44d4a1
commit 95093366f7
1 changed files with 18 additions and 16 deletions

View File

@ -2977,21 +2977,32 @@ Filtering is useful for obvious reasons
(add-hook 'pdf-annot-list-mode-hook #'pdf-annot-list-follow-minor-mode)) (add-hook 'pdf-annot-list-mode-hook #'pdf-annot-list-follow-minor-mode))
#+END_SRC #+END_SRC
** mu4e ** mu4e
Since mu4e is an external program, need to check that it is installed before loading anything. Initialize by running the following command in a shell to tell mu about my personal email addresses and where mail should be stored:
#+BEGIN_SRC sh
mu init --my-address=ndwar@yavin4.ch --my-address=natedwarshuis@gmail.com --my-address=ndwarshuis3@gatech.edu --my-address=ndwarsh@emory.edu --maildir=/mnt/data/Mail
#+END_SRC
The following will only run if the =mu= command is found (which it won't be if this is run on windows).
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(nd/when-bin "mu" (nd/when-bin "mu"
(require 'mu4e) (require 'mu4e)
(defun nd/make-mu4e-context (name dir addr smtp-srv sent-behavior) (defun nd/make-mu4e-context (name dir addr smtp-srv sent-behavior)
(let ((trash (format "/%s/trash" dir)) (let* ((trash (format "/%s/trash" dir))
(drafts (format "/%s/drafts" dir)) (drafts (format "/%s/drafts" dir))
(sent (format "/%s/sent" dir)) (sent (format "/%s/sent" dir))
(archive (format "/%s/archive" dir)) (archive (format "/%s/archive" dir))
(inbox (format "/%s/inbox" dir)) (inbox (format "/%s/inbox" dir))
(shortcuts (--map (list :maildir (car it) :key (cdr it))
`((,trash . ?t)
(,drafts . ?d)
(,sent . ?s)
(,archive . ?a)
(,inbox . ?i))))
(mf (lambda (d msg) (mf (lambda (d msg)
(-some--> (-some--> msg
msg (mu4e-message-field it :maildir)
(mu4e-message-field it :maildir) (string-prefix-p (concat "/" d) it)))))
(string-prefix-p (concat "/" d) it)))))
(make-mu4e-context (make-mu4e-context
:name name :name name
:match-func (-partial mf dir) ; use lexical scope here :match-func (-partial mf dir) ; use lexical scope here
@ -3005,11 +3016,7 @@ Since mu4e is an external program, need to check that it is installed before loa
(smtpmail-smtp-service . 587) (smtpmail-smtp-service . 587)
(smtpmail-smtp-user . ,addr) (smtpmail-smtp-user . ,addr)
(user-mail-address . ,addr) (user-mail-address . ,addr)
(mu4e-maildir-shortcuts . ((,inbox . ?i) (mu4e-maildir-shortcuts . ,shortcuts)))))
(,sent . ?s)
(,trash . ?t)
(,drafts . ?d)
(,archive . ?a)))))))
(setq mail-user-agent 'mu4e-user-agent (setq mail-user-agent 'mu4e-user-agent
message-kill-buffer-on-exit t message-kill-buffer-on-exit t
@ -3021,7 +3028,6 @@ Since mu4e is an external program, need to check that it is installed before loa
mu4e-use-fancy-chars nil mu4e-use-fancy-chars nil
;; directories ;; directories
mu4e-maildir "/mnt/data/Mail"
mu4e-attachment-dir "~/Downloads" mu4e-attachment-dir "~/Downloads"
;; headers ;; headers
@ -3064,10 +3070,6 @@ Since mu4e is an external program, need to check that it is installed before loa
;; contexts (multiple inboxes) ;; contexts (multiple inboxes)
mu4e-context-policy 'pick-first mu4e-context-policy 'pick-first
mu4e-compose-context-policy 'ask-if-none mu4e-compose-context-policy 'ask-if-none
mu4e-user-mail-address-list '("ndwar@yavin4.ch"
"natedwarshuis@gmail.com"
"ndwarshuis3@gatech.edu"
"ndwarsh@emory.edu")
mu4e-contexts mu4e-contexts
(list (list
(nd/make-mu4e-context "personal" (nd/make-mu4e-context "personal"