app/email: mbsync => offlineimap & All Mail-centric workflow (better gmail integration)
This commit is contained in:
parent
49b4b39dfe
commit
a8205e3bbc
1 changed files with 43 additions and 38 deletions
|
@ -53,20 +53,18 @@
|
||||||
mu4e-update-interval nil
|
mu4e-update-interval nil
|
||||||
mu4e-compose-format-flowed t ; visual-line-mode + auto-fill upon sending
|
mu4e-compose-format-flowed t ; visual-line-mode + auto-fill upon sending
|
||||||
mu4e-view-show-addresses t
|
mu4e-view-show-addresses t
|
||||||
mu4e-headers-skip-duplicates t
|
|
||||||
;; try to show images
|
;; try to show images
|
||||||
mu4e-view-show-images t
|
mu4e-view-show-images t
|
||||||
mu4e-view-image-max-width 800
|
mu4e-view-image-max-width 800
|
||||||
;; rename files when moving (required for mbsync)
|
|
||||||
mu4e-change-filenames-when-moving t
|
|
||||||
;; don't save message to Sent Messages, Gmail/IMAP takes care of this
|
;; don't save message to Sent Messages, Gmail/IMAP takes care of this
|
||||||
mu4e-sent-messages-behavior 'delete
|
mu4e-sent-messages-behavior 'delete
|
||||||
;; allow for updating mail using 'U' in the main view:
|
;; allow for updating mail using 'U' in the main view:
|
||||||
;; for mbsync
|
;; for mbsync
|
||||||
mu4e-change-filenames-when-moving t
|
;; mu4e-headers-skip-duplicates t
|
||||||
mu4e-get-mail-command "mbsync -a"
|
;; mu4e-change-filenames-when-moving nil
|
||||||
|
;; mu4e-get-mail-command "mbsync -a"
|
||||||
;; for offlineimap
|
;; for offlineimap
|
||||||
;; mu4e-get-mail-command "offlineimap -o -q"
|
mu4e-get-mail-command "offlineimap -o -q"
|
||||||
;; configuration for sending mail
|
;; configuration for sending mail
|
||||||
message-send-mail-function #'smtpmail-send-it
|
message-send-mail-function #'smtpmail-send-it
|
||||||
smtpmail-stream-type 'starttls
|
smtpmail-stream-type 'starttls
|
||||||
|
@ -88,18 +86,15 @@
|
||||||
(:human-date . 12)
|
(:human-date . 12)
|
||||||
(:flags . 4)
|
(:flags . 4)
|
||||||
(:from . 25)
|
(:from . 25)
|
||||||
(:subject)))
|
(:subject))
|
||||||
|
mu4e-bookmarks `(("\\\\Inbox" "Inbox" ?i)
|
||||||
(let ((inbox-query (mapconcat (lambda (arg) (format " maildir:/%s/Inbox " arg))
|
("flag:unread AND \\\\Inbox" "Unread messages" ?u)
|
||||||
(mapcar #'car +email--accounts) " OR ")))
|
("flag:flagged" "Starred messages" ?s)
|
||||||
(setq mu4e-bookmarks `((,inbox-query "Inbox" ?i)
|
("date:today..now" "Today's messages" ?t)
|
||||||
(,(format "flag:unread AND (%s)" inbox-query)
|
("date:7d..now" "Last 7 days" ?w)
|
||||||
"Unread messages" ?u)
|
("mime:image/*" "Messages with images" ?p)))
|
||||||
("flag:flagged" "Starred messages" ?s)
|
|
||||||
("date:today..now" "Today's messages" ?t)
|
|
||||||
("date:7d..now" "Last 7 days" ?w)
|
|
||||||
("mime:image/*" "Messages with images" ?p))))
|
|
||||||
|
|
||||||
|
;; Add a column to display what email account the email belongs to.
|
||||||
(push '(:account
|
(push '(:account
|
||||||
:name "Account"
|
:name "Account"
|
||||||
:shortname "Account"
|
:shortname "Account"
|
||||||
|
@ -110,46 +105,52 @@
|
||||||
(format "%s" (substring maildir 1 (string-match-p "/" maildir 1))))))
|
(format "%s" (substring maildir 1 (string-match-p "/" maildir 1))))))
|
||||||
mu4e-header-info-custom)
|
mu4e-header-info-custom)
|
||||||
|
|
||||||
;; By default, mark-for-trash deletes the email completely, even from the
|
;; In my workflow, emails won't be moved at all. Only their flags/labels are
|
||||||
;; server. This fix sends trashed email to the trash folder, instead. Note:
|
;; changed. Se we redefine the trash and refile marks not to do any moving.
|
||||||
;; you have to update your mail for them to actually show up in Trash.
|
;; However, the real magic happens in `+email|gmail-fix-flags'.
|
||||||
;; (setq mu4e-marks (assq-delete-all 'delete mu4e-marks))
|
;;
|
||||||
|
;; Gmail will handle the rest.
|
||||||
|
(setq mu4e-marks (assq-delete-all 'delete mu4e-marks))
|
||||||
(setq mu4e-marks (assq-delete-all 'trash mu4e-marks))
|
(setq mu4e-marks (assq-delete-all 'trash mu4e-marks))
|
||||||
(push '(trash :char ("d" . "▼")
|
(push '(trash :char ("d" . "▼")
|
||||||
:prompt "dtrash"
|
:prompt "dtrash"
|
||||||
:dyn-target (lambda (target msg) (mu4e-get-trash-folder msg))
|
:show-target (lambda (target) "trash")
|
||||||
:action
|
:action
|
||||||
(lambda (docid msg target)
|
(lambda (docid msg target)
|
||||||
(mu4e~proc-move docid (mu4e~mark-check-target target) "-N")))
|
(mu4e~proc-move docid (mu4e~mark-check-target target) "+S-u-N")))
|
||||||
mu4e-marks)
|
mu4e-marks)
|
||||||
|
|
||||||
;; Refile will set mail to All Mail (basically archiving them). I want this to
|
;; Refile will be my "archive" function.
|
||||||
;; auto-mark them as read, so I redefine refile to add the +S tag.
|
|
||||||
(setq mu4e-marks (assq-delete-all 'refile mu4e-marks))
|
(setq mu4e-marks (assq-delete-all 'refile mu4e-marks))
|
||||||
(push '(refile :char ("r" . "▶")
|
(push '(refile :char ("r" . "▶")
|
||||||
:prompt "refile"
|
:prompt "refile"
|
||||||
:dyn-target (lambda (target msg) (mu4e-get-refile-folder msg))
|
:show-target (lambda (target) "archive")
|
||||||
:action
|
:action
|
||||||
(lambda (docid msg target)
|
(lambda (docid msg target)
|
||||||
(mu4e~proc-move docid (mu4e~mark-check-target target) "-u-N")))
|
(mu4e~proc-move docid (mu4e~mark-check-target target) "+S-u-N")))
|
||||||
mu4e-marks)
|
mu4e-marks)
|
||||||
|
|
||||||
;; This hook correctly modifies the \Inbox and \Starred flags on email when
|
;; This hook correctly modifies gmail flags on emails when they are marked.
|
||||||
;; they are marked. Without it refiling (archiving) and flagging (starring)
|
;; Without it refiling (archiving), trashing, and flagging (starring) email
|
||||||
;; email won't properly result in the corresponding gmail action.
|
;; won't properly result in the corresponding gmail action, since the marks
|
||||||
|
;; are ineffectual otherwise.
|
||||||
(defun +email|gmail-fix-flags (mark msg)
|
(defun +email|gmail-fix-flags (mark msg)
|
||||||
(cond ((memq mark '(trash refile)) (mu4e-action-retag-message msg "-\\Inbox"))
|
(cond ((eq mark 'trash) (mu4e-action-retag-message msg "-\\Inbox,+\\Trash"))
|
||||||
|
((memq mark '(read refile)) (mu4e-action-retag-message msg "-\\Inbox,+\\Seen"))
|
||||||
((eq mark 'flag) (mu4e-action-retag-message msg "+\\Starred"))
|
((eq mark 'flag) (mu4e-action-retag-message msg "+\\Starred"))
|
||||||
((eq mark 'unflag) (mu4e-action-retag-message msg "-\\Starred"))))
|
((eq mark 'unflag) (mu4e-action-retag-message msg "-\\Starred"))))
|
||||||
(add-hook 'mu4e-mark-execute-pre-hook #'+email|gmail-fix-flags)
|
(add-hook 'mu4e-mark-execute-pre-hook #'+email|gmail-fix-flags)
|
||||||
|
|
||||||
|
;; Refresh the current view after marks are executed
|
||||||
|
(defun +email*refresh (&rest _) (mu4e-headers-rerun-search))
|
||||||
|
(advice-add #'mu4e-mark-execute-all :after #'+email*refresh)
|
||||||
|
|
||||||
(when (featurep! :feature spellcheck)
|
(when (featurep! :feature spellcheck)
|
||||||
(add-hook 'mu4e-compose-mode-hook #'flyspell-mode))
|
(add-hook 'mu4e-compose-mode-hook #'flyspell-mode))
|
||||||
|
|
||||||
;; Brighter + no mode-line in message windows
|
;; Brighter + no mode-line in message windows
|
||||||
(after! doom-themes
|
(after! doom-themes
|
||||||
(add-hook! 'mu4e-view-mode-hook
|
(add-hook 'mu4e-view-mode-hook #'doom-buffer-mode))
|
||||||
#'(doom-buffer-mode doom-hide-modeline-mode)))
|
|
||||||
|
|
||||||
;; Wrap text in messages
|
;; Wrap text in messages
|
||||||
(add-hook! 'mu4e-view-mode-hook
|
(add-hook! 'mu4e-view-mode-hook
|
||||||
|
@ -179,13 +180,17 @@
|
||||||
:Lv "r" #'+email/mark-multiple))
|
:Lv "r" #'+email/mark-multiple))
|
||||||
(add-hook 'mu4e-headers-mode-hook #'+email|headers-keybinds)
|
(add-hook 'mu4e-headers-mode-hook #'+email|headers-keybinds)
|
||||||
|
|
||||||
;; (defun +email|view-keybinds ())
|
(defun +email|view-keybinds ()
|
||||||
;; (add-hook 'mu4e-view-mode-hook #'+email|view-keybinds)
|
(map! :Lm "-" #'mu4e-headers-mark-for-unflag
|
||||||
|
:Lm "+" #'mu4e-headers-mark-for-flag
|
||||||
|
:Lm "v" #'evil-visual-line
|
||||||
|
:Lm "q" #'mu4e~headers-quit-buffer))
|
||||||
|
(add-hook 'mu4e-view-mode-hook #'+email|view-keybinds)
|
||||||
|
|
||||||
(defun +email|main-keybinds ()
|
(defun +email|main-keybinds ()
|
||||||
(map! :Ln "q" #'mu4e-quit
|
(map! :Lm "q" #'mu4e-quit
|
||||||
:Ln "u" #'mu4e-update-index
|
:Lm "u" #'mu4e-update-index
|
||||||
:Ln "U" #'mu4e-update-mail-and-index))
|
:Lm "U" #'mu4e-update-mail-and-index))
|
||||||
(add-hook 'mu4e-main-mode-hook #'+email|main-keybinds))
|
(add-hook 'mu4e-main-mode-hook #'+email|main-keybinds))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue