1 ;;; bandali-message.el --- bandali's message.el setup -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2018-2020 Amin Bandali
5 ;; Author: Amin Bandali <bandali@gnu.org>
6 ;; Keywords: mail, news
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
23 ;; My setup for message.el.
28 :bind
(:map message-mode-map
("<C-return>" . b
/insert-asterism
))
30 ;; redefine for a simplified In-Reply-To header
31 ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
32 (defun message-make-in-reply-to ()
33 "Return the In-Reply-To header for this message."
34 (when message-reply-headers
35 (let ((from (mail-header-from message-reply-headers
))
36 (msg-id (mail-header-id message-reply-headers
)))
40 (defconst b
/message-cite-style-format
"On %Y-%m-%d %l:%M %p, %N wrote:")
41 (defconst message-cite-style-bandali
42 '((message-cite-function 'message-cite-original
)
43 (message-citation-line-function 'message-insert-formatted-citation-line
)
44 (message-cite-reply-position 'traditional
)
45 (message-yank-prefix "> ")
46 (message-yank-cited-prefix ">")
47 (message-yank-empty-prefix ">")
48 (message-citation-line-format
49 (if b
/message-cite-say-hi
50 (concat "Hi %F,\n\n" b
/message-cite-style-format
)
51 b
/message-cite-style-format
)))
52 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
53 (setq ;; message-cite-style 'message-cite-style-bandali
54 message-citation-line-format
"%N writes:\n"
55 message-citation-line-function
'message-insert-formatted-citation-line
56 message-kill-buffer-on-exit t
57 message-send-mail-function
'message-send-mail-with-sendmail
58 message-sendmail-envelope-from
'header
59 message-subscribed-address-functions
60 '(gnus-find-subscribed-addresses)
61 message-dont-reply-to-names
62 "\\(\\(amin@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|bandali@fsf\\.org\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)")
63 ;; (require 'company-ebdb)
64 :hook
(;; (message-setup . mml-secure-message-sign-pgpmime)
65 (message-mode . flyspell-mode
)
66 (message-mode .
(lambda ()
67 ;; (setq-local fill-column b/fill-column
68 ;; message-fill-column b/fill-column)
69 (eval-when-compile (defvar company-idle-delay
))
70 (make-local-variable 'company-idle-delay
)
71 (setq company-idle-delay
0.2))))
73 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
74 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
75 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
77 (message-elide-ellipsis "[...]\n"))
82 ;; (setq footnote-start-tag ""
83 ;; footnote-end-tag ""
84 ;; footnote-style 'unicode)
85 (when (featurep 'which-key
)
86 (which-key-add-major-mode-key-based-replacements 'message-mode
87 "C-c f n" "footnote"))
89 (:map message-mode-map
90 :prefix-map b
/footnote-prefix-map
92 ("a" . footnote-add-footnote
)
93 ("b" . footnote-back-to-message
)
94 ("c" . footnote-cycle-style
)
95 ("d" . footnote-delete-footnote
)
96 ("g" . footnote-goto-footnote
)
97 ("r" . footnote-renumber-footnotes
)
98 ("s" . footnote-set-style
)))
101 (use-package message-x
103 (message-x-completion-alist
105 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address
)
108 (quote message-newgroups-header-regexp
))
109 message-newgroups-header-regexp message-newsgroups-header-regexp
)
110 . message-expand-group
))))))
113 (use-package gnus-harvest
114 :commands gnus-harvest-install
117 (if (featurep 'message-x
)
118 (gnus-harvest-install 'message-x
)
119 (gnus-harvest-install))))
121 (use-package orgalist
123 :hook
(message-mode .
(lambda ()
124 ;; work around incompatibility between
125 ;; orgalist and yasnippet
128 (yas-minor-mode 1))))
130 (provide 'bandali-message
)
131 ;;; bandali-message.el ends here