emacs: Revamp mu4e config to make gmail work better
This commit is contained in:
parent
e51d89105d
commit
ec98d3bfab
@ -1836,96 +1836,99 @@ odd looking ~'(t .t)~ is for specifying a default for all other actions.
|
|||||||
** Email
|
** Email
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(when (file-exists-p "/usr/share/emacs/site-lisp/mu4e/")
|
(when (file-exists-p "/usr/share/emacs/site-lisp/mu4e/")
|
||||||
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e/")
|
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e/")
|
||||||
(require 'mu4e)
|
(require 'mu4e)
|
||||||
|
|
||||||
;; Attach files to a message composition buffer by going into `dired'
|
;; Attach files to a message composition buffer by going into `dired'
|
||||||
;; and doing C-c C-m C-a (M-x `gnus-dired-attach').
|
;; and doing C-c C-m C-a (M-x `gnus-dired-attach').
|
||||||
(require 'gnus-dired) ; does not require `gnus'
|
(require 'gnus-dired) ; does not require `gnus'
|
||||||
(add-hook 'dired-mode-hook #'gnus-dired-mode)
|
(add-hook 'dired-mode-hook #'gnus-dired-mode)
|
||||||
(add-hook 'mu4e-main-mode-hook 'olivetti-mode)
|
(add-hook 'mu4e-main-mode-hook 'olivetti-mode)
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("authinfo" . authinfo-mode))
|
(add-to-list 'auto-mode-alist '("authinfo" . authinfo-mode))
|
||||||
|
|
||||||
(setq mu4e-get-mail-command "parallel mbsync -V \"-c ~/.config/mbsync/config\" ::: ferano.io.inbox gmail.allmail")
|
(setq mu4e-get-mail-command "parallel mbsync -V \"-c ~/.config/mbsync/config\" ::: ferano.io gmail")
|
||||||
|
|
||||||
;;; Sending email (SMTP)
|
;;; Sending email (SMTP)
|
||||||
(require 'smtpmail)
|
(require 'smtpmail)
|
||||||
(setq smtpmail-default-smtp-server "mail.gandi.net"
|
(setq smtpmail-default-smtp-server "mail.gandi.net"
|
||||||
smtpmail-smtp-server "mail.gandi.net"
|
smtpmail-smtp-server "mail.gandi.net"
|
||||||
smtpmail-stream-type 'ssl
|
smtpmail-stream-type 'ssl
|
||||||
smtpmail-smtp-service 465
|
smtpmail-smtp-service 465
|
||||||
smtpmail-queue-mail nil)
|
smtpmail-queue-mail nil)
|
||||||
|
|
||||||
(require 'sendmail)
|
(require 'sendmail)
|
||||||
(setq send-mail-function 'smtpmail-send-it)
|
(setq send-mail-function 'smtpmail-send-it)
|
||||||
|
|
||||||
(setq mu4e-update-interval 30)
|
(setq mu4e-update-interval 30)
|
||||||
(setq mu4e-hide-index-messages t)
|
(setq mu4e-hide-index-messages t)
|
||||||
(setq mu4e-completing-read-function 'completing-read)
|
(setq mu4e-completing-read-function 'completing-read)
|
||||||
(setq mu4e-context-policy 'pick-first)
|
(setq mu4e-context-policy 'pick-first)
|
||||||
(setq mu4e-compose-context-policy 'ask)
|
(setq mu4e-compose-context-policy 'ask)
|
||||||
(setq mu4e-view-auto-mark-as-read nil)
|
(setq mu4e-view-auto-mark-as-read nil)
|
||||||
|
|
||||||
;; (setq mu4e-sent-messages-behavior 'sent)
|
;; (setq mu4e-sent-messages-behavior 'sent)
|
||||||
|
|
||||||
(setq message-kill-buffer-on-exit t)
|
(setq message-kill-buffer-on-exit t)
|
||||||
|
|
||||||
(require 'age)
|
(require 'age)
|
||||||
(setq age-default-identity '("~/.local/credentials/personal"))
|
(setq age-default-identity '("~/.local/credentials/personal"))
|
||||||
(setq age-default-recipient '("~/.local/credentials/personal.pub"))
|
(setq age-default-recipient '("~/.local/credentials/personal.pub"))
|
||||||
|
|
||||||
(setq auth-source-do-cache nil)
|
(setq auth-source-do-cache nil)
|
||||||
|
|
||||||
(defun joe/mu4e-auth-get-field (host prop)
|
(defun joe/mu4e-auth-get-field (host prop)
|
||||||
"Find PROP in `auth-sources' for HOST entry."
|
"Find PROP in `auth-sources' for HOST entry."
|
||||||
(when-let ((source (auth-source-search :host host)))
|
(when-let ((source (auth-source-search :host host)))
|
||||||
(if (eq prop :secret)
|
(if (eq prop :secret)
|
||||||
(funcall (plist-get (car source) prop))
|
(funcall (plist-get (car source) prop))
|
||||||
(plist-get (flatten-list source) prop))))
|
(plist-get (flatten-list source) prop))))
|
||||||
|
|
||||||
(setq auth-sources '("~/.local/credentials/authinfo.age"))
|
(setq auth-sources '("~/.local/credentials/authinfo.age"))
|
||||||
|
|
||||||
(setq mu4e-change-filenames-when-moving t)
|
(setq mu4e-change-filenames-when-moving t)
|
||||||
|
|
||||||
(age-file-enable)
|
(age-file-enable)
|
||||||
(age-encryption-mode +1)
|
(age-encryption-mode +1)
|
||||||
(setq mu4e-bookmarks nil)
|
(setq mu4e-bookmarks nil)
|
||||||
(setq mu4e-contexts
|
(setq mu4e-contexts
|
||||||
`(,(make-mu4e-context
|
`(,(make-mu4e-context
|
||||||
:name "Ferano.io"
|
:name "Ferano.io"
|
||||||
:enter-func (lambda () (mu4e-message "Entering ferano.io"))
|
:enter-func (lambda () (mu4e-message "Entering ferano.io"))
|
||||||
:leave-func (lambda () (mu4e-message "Leaving ferano.io"))
|
:leave-func (lambda () (mu4e-message "Leaving ferano.io"))
|
||||||
:match-func (lambda (msg)
|
:match-func (lambda (msg)
|
||||||
(when msg
|
(when msg
|
||||||
(mu4e-message-contact-field-matches
|
(mu4e-message-contact-field-matches
|
||||||
msg :to (joe/mu4e-auth-get-field "mail.gandi.net" :user))))
|
msg :to (joe/mu4e-auth-get-field "mail.gandi.net" :user))))
|
||||||
:vars `((user-mail-address . ,(joe/mu4e-auth-get-field "mail.gandi.net" :user))
|
:vars `((user-mail-address . ,(joe/mu4e-auth-get-field "mail.gandi.net" :user))
|
||||||
(user-full-name . "Joseph Ferano")
|
(user-full-name . "Joseph Ferano")
|
||||||
(mu4e-drafts-folder . "/ferano.io/Drafts/")
|
(mu4e-drafts-folder . "/ferano.io/Drafts/")
|
||||||
(mu4e-trash-folder . "/ferano.io/Trash/")
|
(mu4e-trash-folder . "/ferano.io/Trash/")
|
||||||
(mu4e-sent-folder . "/ferano.io/Sent/")))
|
(mu4e-sent-folder . "/ferano.io/Sent/")))
|
||||||
,(make-mu4e-context
|
,(make-mu4e-context
|
||||||
:name "Gmail"
|
:name "Gmail"
|
||||||
:enter-func (lambda () (mu4e-message "Entering gmail"))
|
:enter-func (lambda () (mu4e-message "Entering gmail"))
|
||||||
:leave-func (lambda () (mu4e-message "Leaving gmail"))
|
:leave-func (lambda () (mu4e-message "Leaving gmail"))
|
||||||
:match-func (lambda (msg)
|
:match-func (lambda (msg)
|
||||||
(when msg
|
(when msg
|
||||||
(mu4e-message-contact-field-matches
|
(mu4e-message-contact-field-matches
|
||||||
msg :to (joe/mu4e-auth-get-field "mail.gmail.com" :user))))
|
msg :to (joe/mu4e-auth-get-field "mail.gmail.com" :user))))
|
||||||
:vars `((user-mail-address . ,(joe/mu4e-auth-get-field "mail.gmail.com" :user))
|
:vars `((user-mail-address . ,(joe/mu4e-auth-get-field "mail.gmail.com" :user))
|
||||||
(user-full-name . "Joseph Ferano")
|
(user-full-name . "Joseph Ferano")
|
||||||
(mu4e-drafts-folder . "/gmail/[Gmail]/Drafts/")
|
(mu4e-drafts-folder . "/gmail/[Gmail]/Drafts/")
|
||||||
(mu4e-trash-folder . "/gmail/[Gmail]/Trash/")
|
(mu4e-trash-folder . "/gmail/[Gmail]/Trash/")
|
||||||
(mu4e-sent-folder . "/gmail/[Gmail]/Sent Mail/")))))
|
(mu4e-sent-folder . "/gmail/[Gmail]/Sent Mail/")
|
||||||
|
(smtpmail-default-smtp-server . "smtp.gmail.com")
|
||||||
(setq mu4e-maildir-shortcuts
|
(smtpmail-smtp-server . "smtp.gmail.com")
|
||||||
|
(smtpmail-stream-type . starttls)
|
||||||
|
(smtpmail-smtp-service . 587)))))
|
||||||
|
(setq mu4e-maildir-shortcuts
|
||||||
'((:maildir "/ferano.io/Inbox" :key ?f)
|
'((:maildir "/ferano.io/Inbox" :key ?f)
|
||||||
(:maildir "/gmail/[Gmail]/All Mail" :key ?g)))
|
(:maildir "/gmail/Inbox" :key ?g)))
|
||||||
|
|
||||||
(mu4e 't)
|
(mu4e 't)
|
||||||
(add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display))
|
(add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display))
|
||||||
;; (:name "Ferano.io Unread" :query "m:/ferano.io/Inbox AND g:unread" :key ?u)))
|
;; (:name "Ferano.io Unread" :query "m:/ferano.io/Inbox AND g:unread" :key ?u)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Fold threads. This is a gist provided by Rougier [[https://gist.github.com/rougier/98e83fb50e19fb73fe34a7ecc5fc1ccc][here]]. His other package is
|
Fold threads. This is a gist provided by Rougier [[https://gist.github.com/rougier/98e83fb50e19fb73fe34a7ecc5fc1ccc][here]]. His other package is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user