More mail configuration

This commit is contained in:
Charlotte Van Petegem 2021-03-22 22:37:25 +01:00
parent 8e1b901372
commit 6c2d57d2b4
No known key found for this signature in database
GPG key ID: 019E764B7184435A

View file

@ -16,8 +16,12 @@
:config :config
(general-evil-setup t) (general-evil-setup t)
(nmap ;; Create bindings under the leader
:prefix "SPC" (general-create-definer lmap :states '(normal visual emacs motion) :prefix "SPC")
(lmap
"" nil ;; Unbind SPC, I don't use it for navigation anyway.
"SPC" '(:ignore t :which-key "mode") "SPC" '(:ignore t :which-key "mode")
":" '(eval-expression :which-key "eval") ":" '(eval-expression :which-key "eval")
@ -70,14 +74,12 @@
:demand t :demand t
:custom (consult-project-root-function #'projectile-project-root "Use projectile to determine project roots.") :custom (consult-project-root-function #'projectile-project-root "Use projectile to determine project roots.")
:general :general
(nmap (lmap
:prefix "SPC"
"bb" '(consult-buffer :which-key "switch") "bb" '(consult-buffer :which-key "switch")
"fr" '(consult-recent-file :which-key "recent") "fr" '(consult-recent-file :which-key "recent")
"ha" '(consult-apropos :which-key "apropos") "ha" '(consult-apropos :which-key "apropos")
"ss" '(consult-line :which-key "search") "ss" '(consult-line :which-key "search")
) )
(nmap "/" 'consult-line)
) )
;; Direnv integration in emacs. ;; Direnv integration in emacs.
@ -129,8 +131,7 @@
(use-package magit (use-package magit
:demand t :demand t
:general :general
(nmap (lmap
:prefix "SPC"
"g" '(:ignore t :which-key "git") "g" '(:ignore t :which-key "git")
"gs" '(magit-status :which-key "status") "gs" '(magit-status :which-key "status")
) )
@ -185,6 +186,7 @@
(mu4e-confirm-quit nil "Don't confirm when quitting") (mu4e-confirm-quit nil "Don't confirm when quitting")
(mu4e-completing-read-function 'completing-read "Use default completing read function") (mu4e-completing-read-function 'completing-read "Use default completing read function")
(mu4e-headers-include-related nil "Don't show related messages by default") (mu4e-headers-include-related nil "Don't show related messages by default")
(mu4e-headers-skip-duplicates nil "Show duplicate emails")
(message-kill-buffer-on-exit t "Close buffer when finished with email") (message-kill-buffer-on-exit t "Close buffer when finished with email")
(sendmail-program "msmtp" "Use msmtp to send email") (sendmail-program "msmtp" "Use msmtp to send email")
(message-sendmail-f-is-evil t "Remove username from the emacs message") (message-sendmail-f-is-evil t "Remove username from the emacs message")
@ -302,10 +304,47 @@
(cdr chosen-el) (cdr chosen-el)
(mu4e-warn "Unknown option: '%s'" choice)))))) (mu4e-warn "Unknown option: '%s'" choice))))))
(apply orig-fun args))) (apply orig-fun args)))
(define-skeleton mail/dodona-teacher-reply-skeleton
"Inserts a typical reply after someone was made a teacher on Dodona."
"Naam leerkracht: "
"Dag " str ",\n"
"\n"
_
"\n"
"Ik heb je account lesgeversrechten gegeven. Je kan nu cursussen aanmaken\n"
"en oefeningen toevoegen aan het platform. Een handleiding over hoe van\n"
"start te gaan met Dodona kan je hier vinden:\n"
"https://dodona-edu.github.io/nl/guides/teachers/getting-started/.\n"
"\n"
"Als je nog verdere vragen hebt mag je ons altijd via dodona@ugent.be\n"
"contacteren.\n"
"\n"
"Met vriendelijke groeten,\n"
"Charlotte Van Petegem"
)
(defun mail/dodona-cc-reply-to ()
"Add dodona@ugent.be in cc and reply-to headers."
(interactive)
(save-excursion (message-add-header "Cc: dodona@ugent.be\nReply-To: dodona@ugent.be\n"))
)
(add-hook
'mu4e-compose-mode-hook
(defun mail/auto-dodona-cc-reply-to ()
"Set dodona@ugent.be in CC and Reply-To headers when message was directed to dodona@ugent.be"
(let ((msg mu4e-compose-parent-message))
(when (and msg (mu4e-message-contact-field-matches msg :to "dodona@ugent.be")) (dodona-cc-reply-to))
)
)
)
:general :general
(nmap (lmap "m" '(mu4e :which-key "mail"))
:prefix "SPC" ;; Unmap SPC in the mail view so we can still use the leader.
"m" '(mu4e :which-key "mail") (lmap mu4e-view-mode-map "" nil)
(lmap mu4e-compose-mode-map
"SPC s" '(mml-secure-message-sign-pgpmime :which-key "Sign")
"SPC c" '(mml-secure-message-encrypt-pgpmime :which-key "Encrypt")
"SPC t" '(mail/dodona-teacher-reply-skeleton :which-key "Teacher rights reply")
"SPC d" '(mail/dodona-cc-reply-to :which-key "Dodona support headers")
) )
) )
@ -333,8 +372,7 @@
:diminish (projectile-mode) :diminish (projectile-mode)
:config (projectile-mode 1) :config (projectile-mode 1)
:general :general
(nmap (lmap
:prefix "SPC"
"p" '(:ignore t :which-key "project") "p" '(:ignore t :which-key "project")
"pf" '(projectile-find-file :which-key "find") "pf" '(projectile-find-file :which-key "find")
"pp" '(projectile-switch-project :which-key "switch") "pp" '(projectile-switch-project :which-key "switch")