feat: mu4e Mail

This commit is contained in:
Flinner 2022-02-07 13:26:49 +03:00
parent b2310c4344
commit c778d7136d
Signed by: flinner
GPG Key ID: 95CE0DA7F0E58CA6
1 changed files with 90 additions and 13 deletions

View File

@ -211,18 +211,12 @@ ONLY IN PROG!
should i really be commiting this? :> should i really be commiting this? :>
** auth sources ** auth sources
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq auth-sources '("~/Documents/passowrds/authinfo.gpg" (setq auth-sources '("~/.authinfo.gpg"
"~/.authinfo.gpg"
"secrets:local"; keepassxc db "secrets:local"; keepassxc db
"~/.authinfo" "~/.authinfo"
"~/.netrc")) "~/.netrc"))
#+end_src (require 'epa-file)
(epa-file-enable)
** 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"))))
#+end_src #+end_src
* Help * Help
@ -1874,9 +1868,92 @@ a
#+end_src #+end_src
* Buffers and Windows * Email
** Workspaces (Persepective ** 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 #+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 (use-package persp-mode
:defer t :defer t
:config :config