diff --git a/emacs/init.org b/emacs/init.org index f04bb77..775f669 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -3640,47 +3640,116 @@ Then configure it: mu4e-attachment-dir (expand-file-name "~/Downloads") mu4e-change-filenames-when-moving t user-email-address "jeremy.dormitzer@gmail.com" + mu4e-view-show-images t + mu4e-headers-skip-duplicates t + mail-user-agent 'mu4e-user-agent + ;; Custom actions + mu4e-view-actions '(("capture message" . mu4e-action-capture-message) + ("view as pdf" . mu4e-action-view-as-pdf) + ("show this thread" . mu4e-action-show-thread) + ("View in browser" . mu4e-action-view-in-browser)) ;; Getting mail mu4e-get-mail-command "mbsync -a" ;; Sending mail - mu4e-send-mail-function 'message-send-mail-with-sendmail + send-mail-function 'sendmail-send-it sendmail-program (executable-find "msmtp") ;; Let Gmail handle putting sent messages in the sent folder mu4e-sent-messages-behavior 'delete + ;; Move to trash folder instead of adding trash flag for Gmail mailboxes + mu4e-move-to-trash-patterns '("jeremy-dormitzer-gmail-com" "jeremydormitzer-lola-com") + ;; HTML email rendering + shr-use-colors nil ;; Make sure mu4e knows about my different accounts mu4e-context-policy 'ask mu4e-compose-context-policy 'ask mu4e-contexts - `(,(make-mu4e-context - :name "Personal Gmail" - :match-func (lambda (msg) - (when msg - (string-match-p - "jeremy-dormitzer-gmail-com" - (mu4e-message-field msg :path)))) - :vars '((user-email-address . "jeremy.dormitzer@gmail.com") - (mu4e-sent-folder . "/jeremy-dormitzer-gmail-com/Sent") - (mu4e-drafts-folder . "/jeremy-dormitzer-gmail-com/Drafts") - (mu4e-refile-folder . "/jeremy-dormitzer-gmail-com/Archive") - (mu4e-trash-folder . "/jeremy-dormitzer-gmail-com/Trash") - (mu4e-get-mail-command . "mbsync jeremy-dormitzer-gmail-com") - (message-sendmail-extra-arguments - . ("-a" "jeremy-dormitzer-gmail-com")))) - ,(make-mu4e-context - :name "Lola Gmail" - :match-func (lambda (msg) - (when msg - (string-match-p - "jeremydormitzer-lola-com" - (mu4e-message-field msg :path)))) - :vars '((user-email-address . "jeremydormitzer@lola.com") - (mu4e-sent-folder . "/jeremydormitzer-lola-com/Sent") - (mu4e-drafts-folder . "/jeremydormitzer-lola-com/Drafts") - (mu4e-refile-folder . "/jeremydormitzer-lola-com/Archive") - (mu4e-trash-folder . "/jeremydormitzer-lola-com/Trash") - (mu4e-get-mail-command . "mbsync jeremydormitzer-lola-com") - (message-sendmail-extra-arguments - . ("-a" "jeremydormitzer-lola-com"))))))) + `(,(make-mu4e-context + :name "Personal Gmail" + :match-func (lambda (msg) + (when msg + (string-match-p + "jeremy-dormitzer-gmail-com" + (mu4e-message-field msg :path)))) + :vars '((user-email-address . "jeremy.dormitzer@gmail.com") + (mu4e-sent-folder . "/jeremy-dormitzer-gmail-com/Sent") + (mu4e-drafts-folder . "/jeremy-dormitzer-gmail-com/Drafts") + (mu4e-refile-folder . "/jeremy-dormitzer-gmail-com/Archive") + (mu4e-trash-folder . "/jeremy-dormitzer-gmail-com/Trash") + (mu4e-get-mail-command . "mbsync jeremy-dormitzer-gmail-com") + (message-sendmail-extra-arguments + . ("-a" "jeremy-dormitzer-gmail-com")))) + ,(make-mu4e-context + :name "Lola Gmail" + :match-func (lambda (msg) + (when msg + (string-match-p + "jeremydormitzer-lola-com" + (mu4e-message-field msg :path)))) + :vars '((user-email-address . "jeremydormitzer@lola.com") + (mu4e-sent-folder . "/jeremydormitzer-lola-com/Sent") + (mu4e-drafts-folder . "/jeremydormitzer-lola-com/Drafts") + (mu4e-refile-folder . "/jeremydormitzer-lola-com/Archive") + (mu4e-trash-folder . "/jeremydormitzer-lola-com/Trash") + (mu4e-get-mail-command . "mbsync jeremydormitzer-lola-com") + (message-sendmail-extra-arguments + . ("-a" "jeremydormitzer-lola-com")))))) + + ;; Custom mark function to mark messages matching the current message + (defun mu4e-mark-matching-pred (msg from) + (mu4e-message-contact-field-matches msg :from from)) + + (defun mu4e-mark-matching-input () + (let* ((msg (mu4e-message-at-point t))) + (if (not msg) + (error "No message at point") + (cdr (mu4e-message-field msg :from))))) + + (setq mu4e-headers-custom-markers + '(("Older than" + (lambda + (msg date) + (time-less-p + (mu4e-msg-field msg :date) + date)) + (lambda nil + (mu4e-get-time-date "Match messages before: "))) + ("Newer than" + (lambda + (msg date) + (time-less-p date + (mu4e-msg-field msg :date))) + (lambda nil + (mu4e-get-time-date "Match messages after: "))) + ("Bigger than" + (lambda + (msg bytes) + (> + (mu4e-msg-field msg :size) + (* 1024 bytes))) + (lambda nil + (read-number "Match messages bigger than (Kbytes): "))) + ("Matching current message from: field" + (lambda (msg from) + (mu4e-message-contact-field-matches msg :from from)) + (lambda () + (let* ((msg (mu4e-message-at-point t))) + (if (not msg) + (error "No message at point") + (cdar (mu4e-message-field msg :from)))))))) + + ;; Ugly hack to make sure that shr faces end up at the beginning of the face list + (defun shr-add-font (start end type) + (save-excursion + (goto-char start) + (while (< (point) end) + (when (bolp) + (skip-chars-forward " ")) + ;; Remove the APPEND argument to add-face-text-property + ;; so the face ends up at the head of the face list + (add-face-text-property (point) (min (line-end-position) end) type) + (if (< (line-end-position) end) + (forward-line 1) + (goto-char end)))))) #+end_src Global keybindings: @@ -3688,6 +3757,13 @@ Global keybindings: (leader-def-key "am" #'mu4e) #+end_src +Keybindings within mu4e: +#+begin_src emacs-lisp + (with-eval-after-load 'mu4e + (general-def '(normal motion insert emacs) mu4e-headers-mode-map "t" #'mu4e-headers-mark-thread) + (general-def '(normal motion insert emacs) mu4e-view-mode-map "t" #'mu4e-view-mark-thread)) +#+end_src + * w3m Browsing the web from Emacs. Relies on having [[http://w3m.sourceforge.net/][w3m]] installed. #+BEGIN_SRC emacs-lisp