Assimilate EBDB and move email setup to separate files in lisp/
[~bandali/configs] / lisp / bandali-message.el
1 (use-package message
2 :bind (:map message-mode-map ("<C-return>" . b/insert-asterism))
3 :config
4 ;; redefine for a simplified In-Reply-To header
5 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
6 (defun message-make-in-reply-to ()
7 "Return the In-Reply-To header for this message."
8 (when message-reply-headers
9 (let ((from (mail-header-from message-reply-headers))
10 (msg-id (mail-header-id message-reply-headers)))
11 (when from
12 msg-id))))
13
14 (defconst b/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:")
15 (defconst message-cite-style-bandali
16 '((message-cite-function 'message-cite-original)
17 (message-citation-line-function 'message-insert-formatted-citation-line)
18 (message-cite-reply-position 'traditional)
19 (message-yank-prefix "> ")
20 (message-yank-cited-prefix ">")
21 (message-yank-empty-prefix ">")
22 (message-citation-line-format
23 (if b/message-cite-say-hi
24 (concat "Hi %F,\n\n" b/message-cite-style-format)
25 b/message-cite-style-format)))
26 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
27 (setq ;; message-cite-style 'message-cite-style-bandali
28 message-kill-buffer-on-exit t
29 message-send-mail-function 'message-send-mail-with-sendmail
30 message-sendmail-envelope-from 'header
31 message-subscribed-address-functions
32 '(gnus-find-subscribed-addresses)
33 message-dont-reply-to-names
34 "\\(\\(amin@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)")
35 ;; (require 'company-ebdb)
36 :hook (;; (message-setup . mml-secure-message-sign-pgpmime)
37 (message-mode . flyspell-mode)
38 (message-mode . (lambda ()
39 ;; (setq-local fill-column b/fill-column
40 ;; message-fill-column b/fill-column)
41 (eval-when-compile (defvar company-idle-delay))
42 (make-local-variable 'company-idle-delay)
43 (setq company-idle-delay 0.2))))
44 ;; :custom-face
45 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
46 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
47 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
48 :custom
49 (message-elide-ellipsis "[...]\n"))
50
51 (use-package footnote
52 :after message
53 ;; :config
54 ;; (setq footnote-start-tag ""
55 ;; footnote-end-tag ""
56 ;; footnote-style 'unicode)
57 :bind
58 (:map message-mode-map
59 :prefix-map b/footnote-prefix-map
60 :prefix "C-c f n"
61 ("a" . footnote-add-footnote)
62 ("b" . footnote-back-to-message)
63 ("c" . footnote-cycle-style)
64 ("d" . footnote-delete-footnote)
65 ("g" . footnote-goto-footnote)
66 ("r" . footnote-renumber-footnotes)
67 ("s" . footnote-set-style)))
68
69 (use-package message-x)
70
71 (comment
72 (use-package message-x
73 :custom
74 (message-x-completion-alist
75 (quote
76 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address)
77 ((if
78 (boundp
79 (quote message-newgroups-header-regexp))
80 message-newgroups-header-regexp message-newsgroups-header-regexp)
81 . message-expand-group))))))
82
83 (comment
84 (use-package gnus-harvest
85 :commands gnus-harvest-install
86 :demand
87 :config
88 (if (featurep 'message-x)
89 (gnus-harvest-install 'message-x)
90 (gnus-harvest-install))))
91
92 (provide 'bandali-message)