config/emacs: we are so back

This commit is contained in:
Sakooooo 2024-09-28 21:48:36 +04:00
parent b86f0408bd
commit 2ed9d11c94
Signed by: sako
GPG key ID: FE52FD65B76E4751

View file

@ -1163,39 +1163,10 @@ GNU patch review metho dor sometihng idk
(setq mu4e-update-interval (* 10 60)) (setq mu4e-update-interval (* 10 60))
(setq mu4e-get-mail-command "offlineimap") (setq mu4e-get-mail-command "offlineimap")
(setq mu4e-maildir "~/Mail") (setq mu4e-maildir "~/Mail")
(defvar outlook-mail-address nil) ;; for mail accounts
(defvar proton-mail-address nil) (setq sakomacs-mail-accounts (json-read-file "~/Mail/accounts.json"))
(defvar gmail-1-mail-address nil)
(defvar gmail-2-mail-address nil)
(add-hook 'mu4e-update-pre-hook 'sakomacs/pull-email-address)
(defun sakomacs/pull-email-address ()
(setq outlook-mail-address
(string-trim (shell-command-to-string "pass Microsoft | awk 'BEGIN {ORS=\"\"} FNR == 2{gsub(\"login: \", \"\"); gsub(/ /, \"\"); print}'")))
(defvar proton-mail-address nil)
(defun get-proton-mail-address-from-pass (command)
"Execute COMMAND, concatenate its output with 'hello', and store it in my-greeting."
(let ((output (shell-command-to-string command)))
(setq output (string-trim output))
(setq proton-mail-address (concat output "@proton.me"))))
(get-proton-mail-address-from-pass "pass 'Proton Account' | awk 'BEGIN {ORS=\"\"} FNR == 2{gsub(\"login: \", \"\"); gsub(/ /, \"\"); print}'")
(setq gmail-1-mail-address
(string-trim (shell-command-to-string "pass accounts.google.com/one | awk 'BEGIN {ORS=\"\"} FNR == 2{gsub(\"login: \", \"\"); gsub(/ /, \"\"); print}'")))
(setq gmail-2-mail-address
(string-trim (shell-command-to-string "pass accounts.google.com/two | awk 'BEGIN {ORS=\"\"} FNR == 2{gsub(\"login: \", \"\"); gsub(/ /, \"\"); print}'")))
)
(setq mu4e-context-policy 'pick-first) (setq mu4e-context-policy 'pick-first)
(setq mu4e-compose-context-policy 'always-ask) (setq mu4e-compose-context-policy 'always-ask)
(setq mu4e-contexts (setq mu4e-contexts
@ -1207,7 +1178,7 @@ GNU patch review metho dor sometihng idk
(lambda (msg) (lambda (msg)
(when msg (when msg
(string-prefix-p "/Outlook" (mu4e-message-field msg :maildir)))) (string-prefix-p "/Outlook" (mu4e-message-field msg :maildir))))
:vars `((user-mail-address . ,outlook-mail-address) :vars `((user-mail-address . (cdr (assoc 'outlook sakomacs-mail-accounts)))
(user-full-name . "Sako") (user-full-name . "Sako")
(mu4e-drafts-folder . "/Outlook/Drafts") (mu4e-drafts-folder . "/Outlook/Drafts")
(mu4e-sent-folder . "/Outlook/Sent") (mu4e-sent-folder . "/Outlook/Sent")
@ -1221,7 +1192,7 @@ GNU patch review metho dor sometihng idk
(lambda (msg) (lambda (msg)
(when msg (when msg
(string-prefix-p "/Proton" (mu4e-message-field msg :maildir)))) (string-prefix-p "/Proton" (mu4e-message-field msg :maildir))))
:vars `((user-mail-address . ,proton-mail-address) :vars `((user-mail-address . (cdr (assoc 'protonmail sakomacs-mail-accounts)))
(user-full-name . "Sako") (user-full-name . "Sako")
(mu4e-drafts-folder . "/Proton/Drafts") (mu4e-drafts-folder . "/Proton/Drafts")
(mu4e-sent-folder . "/Proton/Sent") (mu4e-sent-folder . "/Proton/Sent")
@ -1235,7 +1206,7 @@ GNU patch review metho dor sometihng idk
(lambda (msg) (lambda (msg)
(when msg (when msg
(string-prefix-p "/Gmail-Personal-1" (mu4e-message-field msg :maildir)))) (string-prefix-p "/Gmail-Personal-1" (mu4e-message-field msg :maildir))))
:vars `((user-mail-address . ,gmail-1-mail-address) :vars `((user-mail-address . (cdr (assoc 'gmail-1 sakomacs-mail-accounts)))
(user-full-name . "Sako") (user-full-name . "Sako")
(mu4e-drafts-folder . "/Gmail-Personal-1/Drafts") (mu4e-drafts-folder . "/Gmail-Personal-1/Drafts")
(mu4e-sent-folder . "/Gmail-Personal-1/Sent Mail") (mu4e-sent-folder . "/Gmail-Personal-1/Sent Mail")
@ -1249,7 +1220,7 @@ GNU patch review metho dor sometihng idk
(lambda (msg) (lambda (msg)
(when msg (when msg
(string-prefix-p "/Gmail-Personal-2" (mu4e-message-field msg :maildir)))) (string-prefix-p "/Gmail-Personal-2" (mu4e-message-field msg :maildir))))
:vars `((user-mail-address . ,gmail-2-mail-address) :vars `((user-mail-address . (cdr (assoc 'gmail-2 sakomacs-mail-accounts)))
(user-full-name . "Sako") (user-full-name . "Sako")
(mu4e-drafts-folder . "/Gmail-Personal-2/Drafts") (mu4e-drafts-folder . "/Gmail-Personal-2/Drafts")
(mu4e-sent-folder . "/Gmail-Personal-2/Sent Mail") (mu4e-sent-folder . "/Gmail-Personal-2/Sent Mail")