diff options
-rwxr-xr-x | emacs.org | 164 |
1 files changed, 83 insertions, 81 deletions
@@ -796,93 +796,95 @@ Create function to watch videos using ~mpv~ ** Setting up mail #+begin_src emacs-lisp (require 'smtpmail) - (when (require 'mu4e nil 'noerror) - (when is-zeus (setq mu4e-update-interval (* 10 60))) - (setq mu4e-get-mail-command "mbsync -a") + (require 'mu4e) - (defun set-mu4e-context (context-name full-name mail-address signature) - "Return a mu4e context named CONTEXT-NAME with :match-func matching + (when is-zeus (setq mu4e-update-interval (* 10 60))) + + (setq mu4e-get-mail-command "mbsync -a") + + (defun set-mu4e-context (context-name full-name mail-address signature) + "Return a mu4e context named CONTEXT-NAME with :match-func matching folder name CONTEXT-NAME in Maildir. The context's `user-mail-address', `user-full-name' and `mu4e-compose-signature'`smtpmail-smpt-server' is set to MAIL-ADDRESS FULL-NAME SIGNATURE and SERVER respectively. Special folders are set to context specific folders." - (let ((dir-name (concat "/" context-name))) - (make-mu4e-context - :name context-name - ;; we match based on the maildir of the message - :match-func - `(lambda (msg) + (let ((dir-name (concat "/" context-name))) + (make-mu4e-context + :name context-name + ;; we match based on the maildir of the message + :match-func + `(lambda (msg) + (when msg + (string-match-p + ,(concat "^" dir-name) + (mu4e-message-field msg :maildir)))) + :vars + `((user-mail-address . ,mail-address) + (user-full-name . ,full-name) + (mu4e-sent-folder . ,(concat dir-name "/Sent")) + (mu4e-drafts-folder . ,(concat dir-name "/Drafts")) + (mu4e-trash-folder . ,(concat dir-name "/Trash")) + (mu4e-trash-folder . ,(concat dir-name "/Starred")) + (mu4e-refile-folder . ,(concat dir-name "/Archive")) + (mu4e-compose-signature . ,signature))))) + ;;Fixing duplicate UID errors when using mbsync and mu4e + (setq mu4e-change-filenames-when-moving t) + + (setq mu4e-maildir-shortcuts + '(("/Public/Inbox" . ?I) + ("/Inbox" . ?i) + ("/Sent" . ?s) + ("/MUSofia/Inbox" . ?m) + )) + + (setq mu4e-contexts + (list + (make-mu4e-context + :name "Fastmail" + :match-func + (lambda (msg) (when msg - (string-match-p - ,(concat "^" dir-name) - (mu4e-message-field msg :maildir)))) - :vars - `((user-mail-address . ,mail-address) - (user-full-name . ,full-name) - (mu4e-sent-folder . ,(concat dir-name "/Sent")) - (mu4e-drafts-folder . ,(concat dir-name "/Drafts")) - (mu4e-trash-folder . ,(concat dir-name "/Trash")) - (mu4e-trash-folder . ,(concat dir-name "/Starred")) - (mu4e-refile-folder . ,(concat dir-name "/Archive")) - (mu4e-compose-signature . ,signature))))) - ;;Fixing duplicate UID errors when using mbsync and mu4e - (setq mu4e-change-filenames-when-moving t) - - (setq mu4e-maildir-shortcuts - '(("/Public/Inbox" . ?I) - ("/Inbox" . ?i) - ("/Sent" . ?s) - ("/MUSofia/Inbox" . ?m) - )) - - (setq mu4e-contexts - (list - (make-mu4e-context - :name "Fastmail" - :match-func - (lambda (msg) - (when msg - (string-prefix-p "/" (mu4e-message-field msg :maildir)))) - :vars '((user-mail-address . "[email protected]") - (user-full-name . "Thanos Apollo") - (mu4e-drafts-folder . "/Drafts") - (mu4e-sent-folder . "/Sent") - (mu4e-refile-folder . "/Archive") - (mu4e-trash-folder . "/Trash"))) - (make-mu4e-context - :name "Public" - :match-func - (lambda (msg) - (when msg - (string-prefix-p "/" (mu4e-message-field msg :maildir)))) - :vars '((user-mail-address . "[email protected]") - (user-full-name . "Thanos Apollo") - (smtpmail-smtp-server . "smtp.fastmail.com") - (smtpmail-smtp-user . "[email protected]") - (smtpmail-smtp-service . 465) - (mu4e-drafts-folder . "/Drafts") - (mu4e-sent-folder . "/Sent") - (mu4e-refile-folder . "/Archive") - (mu4e-trash-folder . "/Trash"))))) - - (setq message-send-mail-function 'smtpmail-send-it - smtpmail-smtp-server "smtp.fastmail.com" - smtpmail-smtp-service 465 - smtpmail-smtp-user "[email protected]" - smtpmail-stream-type 'ssl - mu4e-compose-signature "Thanos Apollo\nhttps://thanosapollo.com" - mu4e-compose-context-policy 'ask-if-none - mu4e-compose-format-flowed t) - - (setq mu4e-view-actions - (delete-dups - (append - '(("gapply git patches" . mu4e-action-git-apply-patch) - ("mgit am patch" . mu4e-action-git-apply-mbox) - ("bb4 am patch" . mu4e-action-git-apply-b4) - ("ssetup reword list with b4" . mu4e-action-setup-reword-b4) - ("crun checkpatch script" . my-mu4e-action-run-check-patch) - ("MCheck if merged" . my-mu4e-action-check-if-merged)))))) + (string-prefix-p "/" (mu4e-message-field msg :maildir)))) + :vars '((user-mail-address . "[email protected]") + (user-full-name . "Thanos Apollo") + (mu4e-drafts-folder . "/Drafts") + (mu4e-sent-folder . "/Sent") + (mu4e-refile-folder . "/Archive") + (mu4e-trash-folder . "/Trash"))) + (make-mu4e-context + :name "Public" + :match-func + (lambda (msg) + (when msg + (string-prefix-p "/" (mu4e-message-field msg :maildir)))) + :vars '((user-mail-address . "[email protected]") + (user-full-name . "Thanos Apollo") + (smtpmail-smtp-server . "smtp.fastmail.com") + (smtpmail-smtp-user . "[email protected]") + (smtpmail-smtp-service . 465) + (mu4e-drafts-folder . "/Drafts") + (mu4e-sent-folder . "/Sent") + (mu4e-refile-folder . "/Archive") + (mu4e-trash-folder . "/Trash"))))) + + (setq message-send-mail-function 'smtpmail-send-it + smtpmail-smtp-server "smtp.fastmail.com" + smtpmail-smtp-service 465 + smtpmail-smtp-user "[email protected]" + smtpmail-stream-type 'ssl + mu4e-compose-signature "Thanos Apollo\nhttps://thanosapollo.com" + mu4e-compose-context-policy 'ask + mu4e-compose-format-flowed t) + + (setq mu4e-view-actions + (delete-dups + (append + '(("gapply git patches" . mu4e-action-git-apply-patch) + ("mgit am patch" . mu4e-action-git-apply-mbox) + ("bb4 am patch" . mu4e-action-git-apply-b4) + ("ssetup reword list with b4" . mu4e-action-setup-reword-b4) + ("crun checkpatch script" . my-mu4e-action-run-check-patch) + ("MCheck if merged" . my-mu4e-action-check-if-merged))))) #+end_src ** Actions #+begin_src emacs-lisp |