From c778d7136d6b30c5f0172572149279868a8d96f5 Mon Sep 17 00:00:00 2001 From: Flinner Date: Mon, 7 Feb 2022 13:26:49 +0300 Subject: [PATCH] feat: mu4e Mail --- emacs.mine/.config/emacs.mine/emacs.org | 103 +++++++++++++++++++++--- 1 file changed, 90 insertions(+), 13 deletions(-) diff --git a/emacs.mine/.config/emacs.mine/emacs.org b/emacs.mine/.config/emacs.mine/emacs.org index 5df3e1c..a55b5a7 100644 --- a/emacs.mine/.config/emacs.mine/emacs.org +++ b/emacs.mine/.config/emacs.mine/emacs.org @@ -211,18 +211,12 @@ ONLY IN PROG! should i really be commiting this? :> ** auth sources #+begin_src emacs-lisp - (setq auth-sources '("~/Documents/passowrds/authinfo.gpg" - "~/.authinfo.gpg" + (setq auth-sources '("~/.authinfo.gpg" "secrets:local"; keepassxc db "~/.authinfo" "~/.netrc")) -#+end_src - -** List my passwords :( -#+begin_src emacs-lisp - ;; (setq my/secret/znc/flinner.my.to/secret (secrets-get-secret "local" "znc/flinner.my.to")) - ;; (setq my/secret/znc/flinner.my.to/username - ;; (cdr (assq :username (secrets-get-attributes "local" "znc/flinner.my.to")))) +(require 'epa-file) +(epa-file-enable) #+end_src * Help @@ -714,8 +708,8 @@ slow loading! defer it ("C-p". company-select-previous) ("M-<". company-select-first) ("M->". company-select-last))) - - + + ;; (use-package company-lsp) (use-package company-box :after company @@ -1874,9 +1868,92 @@ a #+end_src -* Buffers and Windows -** Workspaces (Persepective +* Email +** Contexts +#+begin_src emacs-lisp + ;; assumed Maildir layout + ;; ~/Maildir/Account0/{Inbox,Sent,Trash} + ;; ~/Maildir/Account1/{Inbox,Sent,Trash} + ;; where Account0 is context name + (defun my-make-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' is set to MAIL-ADDRESS + FULL-NAME and SIGNATURE respectively. + Special folders are set to context specific folders." + (let ((dir-name (concat "/" context-name)) + (context-filter (concat " maildir:/" context-name "/"))) + (make-mu4e-context + :name context-name + ;; we match based on the maildir of the message + ;; this matches maildir /Arkham and its sub-directories + :match-func + `(lambda (msg) + (when msg + (string-match-p + ,(concat "^" dir-name) + (mu4e-message-field msg :maildir)))) + :vars + `( + (mu4e-bookmarks . + ,`((:name "Unread messages" :query ,(concat "flag:unread AND NOT flag:trashed" context-filter) :key ?u) + (:name "Today's messages" :query ,(concat "date:today..now" context-filter) :key ?t) + (:name "Last 7 days" :query ,(concat "date:7d..now" context-filter) :hide-unread t :key ?w) + (:name "Messages with images" :query ,(concat "mime:image/*" context-filter) :key ?p))) + + (user-mail-address . ,mail-address) + ;; (mu4e-maildir . ,(concat "~/.mail" dir-name)) + (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-refile-folder . ,(concat dir-name "/Archive")) + (mu4e-compose-signature . ,signature))))) + ;;Fixing duplicate UID errors when using mbsync and mu4e +#+end_src + +** Package +#+begin_src emacs-lisp + (use-package mu4e + ;; :ensure-system-package mu + :config + ;; (add-to-list 'mu4e-view-actions '("view in browser" . mu4e-view-action)) + (add-hook 'mu4e-view-mode-hook #'visual-line-mode) + (add-hook 'mu4e-compose-mode-hook 'flyspell-mode) + :custom + (mu4e-html2text-command "iconv -c -t utf-8 | pandoc -f html -t plain") + (mu4e-attachment-dir "~/Downloads") + (mu4e-compose-signature-auto-include nil) + (mu4e-get-mail-command "mbsync -a") + + (mu4e-update-interval 300) + (mu4e-use-fancy-chars t) + (mu4e-view-show-addresses t) + (mu4e-view-show-images t)) + +#+end_src + +** Email List here! #+begin_src emacs-lisp :tangle no + (setq mu4e-contexts `( + ,(my-make-mu4e-context + "maildir-context" "Full Name" + "Email Address" "Signature") + ,(my-make-mu4e-context + "maildir-context2" "Full Name2" + "Email Address2" "Signature2") + )) +#+end_src + +or don't include in git source :) +#+begin_src emacs-lisp +(eval-after-load 'mu4e + (load "~/Documents/passwords/mu4e-context.el")) +#+end_src + +* Buffers and Windows +** COMMENT Workspaces (Persepective +#+begin_src emacs-lisp (use-package persp-mode :defer t :config