Skip to content

Instantly share code, notes, and snippets.

@shrysr
Created January 6, 2020 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrysr/5452375ed47a090c6e16e0135805f0cb to your computer and use it in GitHub Desktop.
Save shrysr/5452375ed47a090c6e16e0135805f0cb to your computer and use it in GitHub Desktop.
(if (system-type-is-darwin)
(progn
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
(require 'mu4e)
(require 'mu4e-contrib)
(require 'org-mu4e)
(setq
mue4e-headers-skip-duplicates t
mu4e-view-show-images t
mu4e-view-show-addresses 't
mu4e-compose-format-flowed t
;;mu4e-update-interval 200
message-ignored-cited-headers 'nil
mu4e-date-format "%y/%m/%d"
mu4e-headers-date-format "%Y/%m/%d"
mu4e-change-filenames-when-moving t
mu4e-attachments-dir "~/Downloads/Mail-Attachments/"
mu4e-maildir (expand-file-name "~/my_mail/fmail")
message-citation-line-format "On %Y-%m-%d at %R %Z, %f wrote..."
mu4e-index-lazy-check t
)
;; mu4e email refiling loations
(setq
mu4e-refile-folder "/Archive"
mu4e-trash-folder "/Trash"
mu4e-sent-folder "/Sent"
mu4e-drafts-folder "/Drafts"
)
;; setup some handy shortcuts
(setq mu4e-maildir-shortcuts
'(("/INBOX" . ?i)
("/Sent" . ?s)
("/Archive" . ?a)
("/Trash" . ?t)))
;;store link to message if in header view, not to header query
(setq org-mu4e-link-query-in-headers-mode nil
org-mu4e-convert-to-html t) ;; org -> html
;; Enabling view in browser for HTML heavy emails that don't render well
(add-to-list 'mu4e-view-actions
'("ViewInBrowser" . mu4e-action-view-in-browser) t)
(autoload 'mu4e "mu4e" "mu for Emacs." t)
;; Config for sending email
(setq
message-send-mail-function 'message-send-mail-with-sendmail
send-mail-function 'sendmail-send-it
message-kill-buffer-on-exit t
)
;; allow for updating mail using 'U' in the main view:
(setq mu4e-get-mail-command "mbsync -a -q")
;; Don't keep asking for confirmation for every action
(defun my-mu4e-mark-execute-all-no-confirm ()
"Execute all marks without confirmation."
(interactive)
(mu4e-mark-execute-all 'no-confirm))
;; mapping x to above function
(define-key mu4e-headers-mode-map "x" #'my-mu4e-mark-execute-all-no-confirm)
;; source: http://matt.hackinghistory.ca/2016/11/18/sending-html-mail-with-mu4e/
;; this is stolen from John but it didn't work for me until I
;; made those changes to mu4e-compose.el
(defun htmlize-and-send ()
"When in an org-mu4e-compose-org-mode message, htmlize and send it."
(interactive)
(when
(member 'org~mu4e-mime-switch-headers-or-body post-command-hook)
(org-mime-htmlize)
(org-mu4e-compose-org-mode)
(mu4e-compose-mode)
(message-send-and-exit)))
;; This overloads the amazing C-c C-c commands in org-mode with one more function
;; namely the htmlize-and-send, above.
(add-hook 'org-ctrl-c-ctrl-c-hook 'htmlize-and-send t)
))
(use-package mu4e
:ensure nil
:hook
((mu4e-view-mode . visual-line-mode)
(mu4e-compose-mode . (lambda ()
(visual-line-mode)
(use-hard-newlines -1)
(flyspell-mode)))
(mu4e-view-mode . (lambda() ;; try to emulate some of the eww key-bindings
(local-set-key (kbd "<tab>") 'shr-next-link)
(local-set-key (kbd "<backtab>") 'shr-previous-link)))
(mu4e-headers-mode . (lambda ()
(interactive)
(setq mu4e-headers-fields
`((:human-date . 25) ;; alternatively, use :date
(:flags . 6)
(:from . 22)
(:thread-subject . ,(- (window-body-width) 70)) ;; alternatively, use :subject
(:size . 7))))))
:custom
(mu4e-update-interval 150)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment