Add email/{wanderlust,mu4e,notmuch} modules

Removed app/{email,notmuch}
This commit is contained in:
Henrik Lissner 2019-05-05 14:11:59 -04:00
parent 45266213a5
commit 84c5da844b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
16 changed files with 178 additions and 89 deletions

View file

@ -0,0 +1,78 @@
;;; email/mu4e/autoload/email.el -*- lexical-binding: t; -*-
;;;###autodef
(defun set-email-account! (label letvars &optional default-p)
"Registers an email address for mu4e. The LABEL is a string. LETVARS are a
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)
+ `smtpmail-smtp-user' (required for sending mail from Emacs)
OPTIONAL:
+ `mu4e-sent-folder'
+ `mu4e-drafts-folder'
+ `mu4e-trash-folder'
+ `mu4e-refile-folder'
+ `mu4e-compose-signature'
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))
(setq mu4e-contexts
(cl-loop for context in mu4e-contexts
unless (string= (mu4e-context-name context) label)
collect context))
(let ((context (make-mu4e-context
:name label
:enter-func (lambda () (mu4e-message "Switched to %s" label))
:leave-func #'mu4e-clear-caches
:match-func
(lambda (msg)
(when msg
(string-prefix-p (format "/%s" label)
(mu4e-message-field msg :maildir))))
:vars letvars)))
(push context mu4e-contexts)
(when default-p
(setq-default mu4e-context-current context))
context)))
(defvar +mu4e-workspace-name "*mu4e*"
"TODO")
(add-hook 'mu4e-main-mode-hook #'+mu4e|init)
;;;###autoload
(defun =mu4e ()
"Start email client."
(interactive)
(require 'mu4e)
(+workspace-switch +mu4e-workspace-name t)
(mu4e~start 'mu4e~main-view)
;; (save-selected-window
;; (prolusion-mail-show))
)
;;;###autoload
(defun +mu4e/compose ()
"Compose a new email."
(interactive)
;; TODO Interactively select email account
(call-interactively #'mu4e-compose-new))
;;
;; Hooks
(defun +mu4e|init ()
(add-hook 'kill-buffer-hook #'+mu4e|kill-mu4e nil t))
(defun +mu4e|kill-mu4e ()
;; (prolusion-mail-hide)
(when (+workspace-exists-p +mu4e-workspace-name)
(+workspace/delete +mu4e-workspace-name)))

View file

@ -0,0 +1,21 @@
;; email/mu4e/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :editor evil)
;;;###autoload
(defun +mu4e/mark (&optional beg end)
"Mark all messages within the current selection in mu4e's header view. Uses
`this-command-keys' to see what flag you mean."
(interactive)
(let* ((beg (or beg (and (region-active-p) evil-visual-beginning) (line-beginning-position)))
(end (or end (and (region-active-p) evil-visual-end) (line-end-position)))
(key (this-command-keys))
(command
(car (cl-find-if (lambda (mark) (equal (car (plist-get (cdr mark) :char)) key))
mu4e-marks))))
(unless command
(error "Not a valid mark command: %s" key))
(when (bound-and-true-p evil-mode)
(evil-normal-state))
(goto-char beg)
(dotimes (_ (count-lines beg end))
(mu4e-headers-mark-and-next command))))