mail.el 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. ;; center buffer content
  2. (add-hook 'gnus-article-mode-hook 'olivetti-mode)
  3. ;; only sign
  4. (add-hook 'gnus-message-setup-hook 'mml-secure-message-sign-pgpmime)
  5. (add-hook 'message-setup-hook 'mml-secure-message-sign-pgpmime)
  6. ;; https://lists.gnu.org/archive/html/guix-devel/2020-09/msg00024.html
  7. (setq mml-secure-openpgp-sign-with-sender t)
  8. (setq mail-user-agent 'gnus-user-agent)
  9. ;; (setq epg-config--program-alist
  10. ;; '((OpenPGP epg-gpg-program
  11. ;; ;; ("gpg2" . "2.1.6")
  12. ;; ("gpg" . "1.4.3"))
  13. ;; (CMS epg-gpgsm-program ("gpgsm" . "2.0.4"))))
  14. (with-eval-after-load 'mailcap
  15. (add-to-list 'mailcap-mime-extensions '(".scm" . "text/x-scheme")))
  16. (defun wi-send-buffer-as-mail ()
  17. "Send current buffer as body in email."
  18. (interactive)
  19. (let ((str (buffer-string)))
  20. (compose-mail)
  21. (save-excursion
  22. (message-goto-body)
  23. (insert str))))
  24. ;; https://jonathanchu.is/posts/emacs-notmuch-isync-msmtp-setup/
  25. ;; Emacs, Notmuch, isync, and msmtp Setup · jonathanchu.is
  26. (with-eval-after-load 'sendmail
  27. (setq smtpmail-debug-info t)
  28. (setq send-mail-function #'sendmail-send-it)
  29. (setq sendmail-program "/home/oleg/.guix-profile/bin/msmtp")
  30. (setq mail-specify-envelope-from t)
  31. (setq message-sendmail-envelope-from 'header)
  32. (setq mail-envelope-from 'header))
  33. (setq smtpmail-queue-mail t) ; Call after typing M-x `smtpmail-send-queued-mail'
  34. ;;;
  35. ;;; Notmuch
  36. ;;;
  37. (autoload 'notmuch-search "notmuch" nil t)
  38. (with-eval-after-load 'notmuch ;overwrites by default
  39. (setq mail-user-agent 'gnus-user-agent))
  40. ;; XXX: Make async before uncommenting
  41. ;; (run-with-timer 0 (* 20 60) '(lambda ()
  42. ;; (interactive)
  43. ;; (unless (get-buffer "*Summary INBOX*")
  44. ;; (notmuch-poll))))
  45. ;;;
  46. ;;; Guix
  47. ;;;
  48. (defun guix-patch-reply ()
  49. (interactive)
  50. (message-goto-body)
  51. ;; GPG
  52. (when (string= "<#secure method=pgpmime mode=sign>"
  53. (buffer-substring (line-beginning-position) (line-end-position)))
  54. (beginning-of-line)
  55. (next-logical-line))
  56. ;; Body
  57. (insert "Hi,\n\n")
  58. (search-forward-regexp "diff --git")
  59. (search-forward-regexp "@@ ")
  60. (beginning-of-line)
  61. (next-logical-line)
  62. (newline 1)
  63. (open-line 2)
  64. (insert "[…]")
  65. (delete-region (point) (point-max))
  66. (newline 2)
  67. (insert "Pushed to master.\n\nThanks,\nOleg.")
  68. ;; CC
  69. (message-goto-cc)
  70. (search-backward-regexp "@")
  71. (insert "-done"))