diff options
author | Óscar Nájera <hi@oscarnajera.com> | 2021-04-24 14:27:49 +0200 |
---|---|---|
committer | Óscar Nájera <hi@oscarnajera.com> | 2021-04-24 14:27:49 +0200 |
commit | db32596ed7fa091ba15a23db05911351417d36eb (patch) | |
tree | ee68c301eaa81ef1f2fa3090cae8f21bc65618f0 /config/doom | |
parent | 338216b876f982551b2349f6a61fe29b2b4f865e (diff) | |
download | dotfiles-db32596ed7fa091ba15a23db05911351417d36eb.tar.gz dotfiles-db32596ed7fa091ba15a23db05911351417d36eb.tar.bz2 dotfiles-db32596ed7fa091ba15a23db05911351417d36eb.zip |
extend email config
Diffstat (limited to 'config/doom')
-rw-r--r-- | config/doom/config.org | 128 | ||||
-rw-r--r-- | config/doom/snippets/message-mode/employer_signature | 13 |
2 files changed, 141 insertions, 0 deletions
diff --git a/config/doom/config.org b/config/doom/config.org index 41cfdf3..0efa051 100644 --- a/config/doom/config.org +++ b/config/doom/config.org @@ -88,3 +88,131 @@ Shamelessly copied from https://tecosaur.github.io/emacs-config/#dictionary "caldav.org" org-directory)) "* %?\n%^T\n%i\n%a"))) #+end_src +* Email +** Notmuch +#+begin_src emacs-lisp :tangle "packages.el" +(package! notmuch) +#+end_src +#+BEGIN_SRC emacs-lisp +(use-package! notmuch + :init (after! org (add-to-list 'org-modules 'ol-notmuch)) + (map! :leader + (:prefix-map ("o" . "open") + :desc "notmuch" "m" #'notmuch)) + :commands notmuch + :bind (:map notmuch-hello-mode-map + ("l" . notmuch-jump-search) + ("/" . notmuch-tree) + :map notmuch-search-mode-map + ("f" . notmuch-search-filter-by-tag) + ("/" . notmuch-tree) + ("d" . notmuch-search-delete-thread) + ("D" . notmuch-search-delete-all) + :map notmuch-show-mode-map + ("d" . notmuch-show-delete-message) + ("D" . notmuch-show-delete-thread-then-exit) + ("i" . notmuch-show-tag-spam) + ) + :config + (setq-default notmuch-search-oldest-first nil) + (setq message-directory "~/.mail/" + message-auto-save-directory "/tmp/" + org-email-link-description-format "%c: %s") + + (setq notmuch-saved-searches + '((:name "inbox" :query "tag:inbox" :key "i" :sort-order newest-first) + (:name "CMK" :query "(tag:CMK-JIRA or tag:lists/gerrit-check_mk) and tag:unread" :key "c") + (:name "flagged" :query "tag:flagged" :key "f") + (:name "sent" :query "tag:sent" :key "s") + (:name "unread" :query "tag:unread" :key "u") + (:name "drafts" :query "tag:draft" :key "d"))) + + (setq notmuch-show-all-tags-list t + notmuch-hello-tag-list-make-query "tag:unread and not tag:killed") + + (setq notmuch-fcc-dirs '((".*@oscarnajera.com" . "hi_pers/Sent") + ("oscar.najera@tribe29.com" . "work/Sent") + ;;(".*@gmail.com" . "\"gmail/[Gmail]/.Sent Mail\"") + )) + + (setq notmuch-crypto-process-mime t) + (setq message-kill-buffer-on-exit t) + + (setq notmuch-archive-tags '("-inbox" "-unread")) + + (setq notmuch-search-line-faces + `(("deleted" . (:strike-through "red")) + ("flagged" . notmuch-search-flagged-face) + ("unread" . notmuch-search-unread-face))) + + (defun notmuch-show-delete-message () + "Delete current message if already marked as deleted undo." + (interactive) + (apply #'notmuch-show-tag-message + (if (member "deleted" (notmuch-show-get-tags)) + '("-deleted") '("+deleted" "-inbox" "-unread")))) + + (defun notmuch-show-tag-spam () + "Tag spam on current message if already marked as spam undo." + (interactive) + (apply #'notmuch-show-tag-message + (if (member "spam" (notmuch-show-get-tags)) + '("-spam") '("+spam" "-inbox" "-unread")))) + + (defun notmuch-show-delete-thread-then-exit () + "Delete all messages in the current buffer, then exit back to search results." + (interactive) + (notmuch-show-tag-all '("+deleted")) + (notmuch-show-next-thread)) + + (defun notmuch-search-delete-thread() + "Delete all messages in the current thread or undelete" + (interactive) + (notmuch-search-tag + (if (member "deleted" (notmuch-search-get-tags)) + '("-deleted") + '("+deleted" "-inbox" "-unread")))) + + (defun notmuch-search-delete-all() + "Delete all messages in the current buffer" + (interactive) + (notmuch-search-tag-all + '("+deleted" "-inbox" "-unread"))) + + + (define-key notmuch-tree-mode-map "d" + (lambda () + "delete message" + (interactive) + (notmuch-tree-tag + (if (member "deleted" (notmuch-tree-get-tags)) + '("-deleted") + '("+deleted" "-inbox" "-unread")))))) +#+END_SRC +** Sending email +#+begin_src emacs-lisp +(after! notmuch + (setq send-mail-function 'smtpmail-send-it + message-send-mail-function 'message-smtpmail-send-it + smtpmail-local-domain "oscarnajera.com") + + (defun set-smtp-server () + (let* ((default-smtp-conf '("default" "mail.oscarnajera.com" 587 starttls "hi")) + (smtp-from-server-alist + '(("Oscar Najera <oscar.najera@tribe29.com>" + "mx.tribe29.com" 587 starttls "on") + ("Oscar Najera <najera.oscar@gmail.com>" + "smtp.googlemail.com" 587 starttls "najera.oscar"))) + (smtp-conf (alist-get (save-restriction + (message-narrow-to-headers) + (message-fetch-field "from")) + smtp-from-server-alist default-smtp-conf))) + (-let [(name server port protocol user) smtp-conf] + (setq smtpmail-smtp-server server + smtpmail-smtp-service port + smtpmail-stream-type protocol + smtpmail-smtp-user user) + (message "SMTP server changed to %s in port %s by %s" server port protocol)))) + + (add-hook 'message-send-mail-hook 'set-smtp-server)) +#+end_src diff --git a/config/doom/snippets/message-mode/employer_signature b/config/doom/snippets/message-mode/employer_signature new file mode 100644 index 0000000..6e202b8 --- /dev/null +++ b/config/doom/snippets/message-mode/employer_signature @@ -0,0 +1,13 @@ +# -*- mode: snippet -*- +# name: employer_signature +# key: sig +# -- +Oscar Najera +Software Developer + +tribe29 GmbH — The Check_MK Company +oscar.najera@tribe29.com | Phone: +49 89 9982 097 00 | https://tribe29.com + +Kellerstraße 29, 81667 München, Germany +Amtsgericht München, HRB 165902 +Geschäftsführer: Jan Justus, Mathias Kettner
\ No newline at end of file |