app/email: redo mu4e->evil integration + improve marks for gmail support

This commit is contained in:
Henrik Lissner 2017-04-19 13:18:03 -04:00
parent a8205e3bbc
commit 1eb580bb77
5 changed files with 126 additions and 63 deletions

View file

@ -0,0 +1,15 @@
;;; app/email/autoload/email.el
;;;###autoload
(defun =email ()
"Start email client."
(interactive)
(call-interactively 'mu4e))
;;;###autoload
(defun +email/compose ()
"Compose a new email."
(interactive)
;; TODO Interactively select email account
(call-interactively 'mu4e-compose-new))

View file

@ -0,0 +1,19 @@
;;; app/email/autoload/evil.el
;;;###autoload
(defun +email/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 (and (region-active-p) evil-visual-beginning) (line-beginning-position)))
(end (or (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 (featurep 'evil)
(evil-normal-state))
(goto-char beg)
(dotimes (_ (count-lines beg end))
(mu4e-headers-mark-and-next command))))