|
@@ -54,7 +54,7 @@ launch the no-attachment warning message defined in
|
|
|
"String to display in the mode line.")
|
|
|
(defvar distopico:mu4e-update-timer nil
|
|
|
"Interval timer object.")
|
|
|
-(defvar distopico:mu4e-mail-address-list)
|
|
|
+(defvar distopico:mu4e-contexts)
|
|
|
(defvar distopico:mu4e-account-alist)
|
|
|
|
|
|
;; General mu4e config
|
|
@@ -64,12 +64,14 @@ launch the no-attachment warning message defined in
|
|
|
mu4e-compose-keep-self-cc nil
|
|
|
mu4e-compose-complete-addresses t
|
|
|
mu4e-compose-dont-reply-to-self t
|
|
|
+ ;; mu4e-change-filenames-when-moving - enable after migrate to mbsync
|
|
|
mu4e-hide-index-messages t
|
|
|
mu4e-headers-auto-update t
|
|
|
mu4e-notification-support t
|
|
|
mu4e-use-fancy-chars t
|
|
|
mu4e-split-view 'horizontal
|
|
|
mu4e-update-interval 300
|
|
|
+ mu4e-context-policy 'pick-first
|
|
|
mu4e-headers-visible-lines 20
|
|
|
mu4e-headers-leave-behavior 'ask
|
|
|
mu4e-headers-fields '((:human-date . 12)
|
|
@@ -165,11 +167,8 @@ launch the no-attachment warning message defined in
|
|
|
;; Default Account
|
|
|
(setq mu4e-sent-folder "/1-Distopico/Sent"
|
|
|
mu4e-drafts-folder "/1-Distopico/Drafts"
|
|
|
- mu4e-trash-folder "/1-Distopico/Trash")
|
|
|
-
|
|
|
-;; mu4e email list
|
|
|
-;; TODO: migrate to mu4e contexts
|
|
|
-(setq mu4e-user-mail-address-list distopico:mu4e-mail-address-list)
|
|
|
+ mu4e-trash-folder "/1-Distopico/Trash"
|
|
|
+ mu4e-refile-folder "/1-Distopico/Archive")
|
|
|
|
|
|
;; Sign/Encrypt
|
|
|
(setq mml-secure-openpgp-encrypt-to-self t
|
|
@@ -194,27 +193,22 @@ launch the no-attachment warning message defined in
|
|
|
;;------------------
|
|
|
;; Functions
|
|
|
;;------------------
|
|
|
-;; Set Account
|
|
|
-(defun distopico:mu4e-set-account ()
|
|
|
- "Set the account for composing a message."
|
|
|
- (let* ((account
|
|
|
- (if mu4e-compose-parent-message
|
|
|
- (let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
|
|
|
- (string-match "/\\(.*?\\)/" maildir)
|
|
|
- (match-string 1 maildir))
|
|
|
- (completing-read (format "Compose with account: (%s) "
|
|
|
- (mapconcat #'(lambda (var) (car var))
|
|
|
- distopico:mu4e-account-alist "/"))
|
|
|
- (mapcar #'(lambda (var) (car var)) distopico:mu4e-account-alist)
|
|
|
- nil t nil nil (caar distopico:mu4e-account-alist))))
|
|
|
- (account-vars (cdr (assoc account distopico:mu4e-account-alist))))
|
|
|
- (if account-vars
|
|
|
- (mapc #'(lambda (var)
|
|
|
- (set (car var) (cadr var)))
|
|
|
- account-vars)
|
|
|
- (error "No email account found"))))
|
|
|
-
|
|
|
-;; Starting the whole mu4e in its own frame
|
|
|
+(defun distopico:mu4e--default-folders (acc-path settings)
|
|
|
+ "Get default folders based in `ACC-PATH' and merge it with `SETTINGS'."
|
|
|
+ (append `((mu4e-sent-folder . ,(format "/%s/Sent" acc-path))
|
|
|
+ (mu4e-drafts-folder . ,(format "/%s/Drafts" acc-path))
|
|
|
+ (mu4e-trash-folder . ,(format "/%s/Trash" acc-path))
|
|
|
+ (mu4e-refile-folder . ,(format "/%s/Archive" acc-path)))
|
|
|
+ settings))
|
|
|
+
|
|
|
+(defun distopico:mu4e--maildir-matches-p (maildir-rx)
|
|
|
+ "Determine if the `maildir' match with `MAILDIR-RX' regexp."
|
|
|
+ (apply-partially
|
|
|
+ (lambda (maildir-rx msg)
|
|
|
+ (when msg
|
|
|
+ (string-match-p maildir-rx (mu4e-message-field msg :maildir))))
|
|
|
+ maildir-rx))
|
|
|
+
|
|
|
(defun mu4e-in-new-frame ()
|
|
|
"Start mu4e in new frame."
|
|
|
(interactive)
|
|
@@ -264,15 +258,13 @@ launch the no-attachment warning message defined in
|
|
|
(delete-other-windows))
|
|
|
(kill-buffer (current-buffer)))))
|
|
|
|
|
|
-;; Toggle related
|
|
|
(defun distopico:mu4e-toggle-headers-include-related ()
|
|
|
- "Toggle `mu4e-headers-include-related' and refresh."
|
|
|
+ "Toggle related `mu4e-headers-include-related' and refresh."
|
|
|
(interactive)
|
|
|
(setq mu4e-search-include-related
|
|
|
(not mu4e-search-include-related))
|
|
|
(mu4e-search-rerun))
|
|
|
|
|
|
-;; Custom add contact
|
|
|
(defun distopico:mu4e-action-add-org-contact (msg)
|
|
|
"Add an org-contact entry based address.
|
|
|
From: address of the \
|
|
@@ -306,19 +298,6 @@ store your org-contacts."
|
|
|
(when (fboundp 'org-capture)
|
|
|
(org-capture nil key))))
|
|
|
|
|
|
-(defun distopico:mu4e-unread-mail-query ()
|
|
|
- "The query to look for unread messages in all account INBOXes."
|
|
|
- (mapconcat
|
|
|
- (lambda (acct)
|
|
|
- (let ((name (car acct)))
|
|
|
- (format "%s"
|
|
|
- (mapconcat (lambda (fmt)
|
|
|
- (format fmt name))
|
|
|
- '("flag:unread AND maildir:'/%s/INBOX'")
|
|
|
- " "))))
|
|
|
- distopico:mu4e-account-alist
|
|
|
- " OR "))
|
|
|
-
|
|
|
(defun distopico:mu4e-new-mail-p ()
|
|
|
"Predicate for if there is new mail or not in Boolean."
|
|
|
(not (eq 0 (string-to-number
|
|
@@ -331,7 +310,7 @@ store your org-contacts."
|
|
|
(shell-command-to-string
|
|
|
(concat "echo -n $( " mu4e-mu-binary " find "
|
|
|
"--muhome " mu4e-mu-home " "
|
|
|
- (distopico:mu4e-unread-mail-query)
|
|
|
+ "flag:unread AND maildir:'/\/*\/INBOX*/'"
|
|
|
" 2>/dev/null | wc -l )"))))
|
|
|
|
|
|
(defun distopico:mu4e-inbox-update ()
|
|
@@ -358,8 +337,6 @@ store your org-contacts."
|
|
|
(interactive)
|
|
|
(mu4e-message "Updating index & cache...")
|
|
|
(mu4e-update-index)
|
|
|
- ;;(mu4e-maildirs-extension-force-update '(16))
|
|
|
- ;;(mu4e-maildirs-extension-index-updated-handler)
|
|
|
(distopico:mu4e-inbox-update))
|
|
|
|
|
|
(defun distopico:message-attachment-present-p ()
|
|
@@ -410,6 +387,7 @@ from: http://mbork.pl/2016-02-06_An_attachment_reminder_in_mu4e"
|
|
|
|
|
|
(defun distopico:mu4e-init-load-hook ()
|
|
|
"Run mu4e in startup."
|
|
|
+ (setq-default mu4e-contexts (eval distopico:mu4e-contexts))
|
|
|
(mu4e t)
|
|
|
(distopico:mu4e-mode-line t))
|
|
|
|
|
@@ -429,7 +407,6 @@ from: http://mbork.pl/2016-02-06_An_attachment_reminder_in_mu4e"
|
|
|
;;-------------------
|
|
|
;; Hooks
|
|
|
;;-------------------
|
|
|
-(add-hook 'mu4e-compose-pre-hook #'distopico:mu4e-set-account)
|
|
|
(add-hook 'mu4e-index-updated-hook #'distopico:mu4e-index-updated-hook)
|
|
|
(add-hook 'mu4e-view-mode-hook #'distopico:mu4e-view-mode-hook)
|
|
|
(add-hook 'mu4e-compose-mode-hook #'distopico:mu4e-compose-mode-hook)
|