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-kill-buffer-on-exit t
55 message-send-mail-function
'message-send-mail-with-sendmail
56 message-sendmail-envelope-from
'header
57 message-subscribed-address-functions
58 '(gnus-find-subscribed-addresses)
59 message-dont-reply-to-names
60 "\\(\\(amin@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|bandali@fsf\\.org\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)")
61 ;; (require 'company-ebdb)
62 :hook
(;; (message-setup . mml-secure-message-sign-pgpmime)
63 (message-mode . flyspell-mode
)
64 (message-mode .
(lambda ()
65 ;; (setq-local fill-column b/fill-column
66 ;; message-fill-column b/fill-column)
67 (eval-when-compile (defvar company-idle-delay
))
68 (make-local-variable 'company-idle-delay
)
69 (setq company-idle-delay
0.2))))
71 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
72 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
73 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
75 (message-elide-ellipsis "[...]\n"))
80 ;; (setq footnote-start-tag ""
81 ;; footnote-end-tag ""
82 ;; footnote-style 'unicode)
83 (when (featurep 'which-key
)
84 (which-key-add-major-mode-key-based-replacements 'message-mode
85 "C-c f n" "footnote"))
87 (:map message-mode-map
88 :prefix-map b
/footnote-prefix-map
90 ("a" . footnote-add-footnote
)
91 ("b" . footnote-back-to-message
)
92 ("c" . footnote-cycle-style
)
93 ("d" . footnote-delete-footnote
)
94 ("g" . footnote-goto-footnote
)
95 ("r" . footnote-renumber-footnotes
)
96 ("s" . footnote-set-style
)))
99 (use-package message-x
101 (message-x-completion-alist
103 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address
)
106 (quote message-newgroups-header-regexp
))
107 message-newgroups-header-regexp message-newsgroups-header-regexp
)
108 . message-expand-group
))))))
111 (use-package gnus-harvest
112 :commands gnus-harvest-install
115 (if (featurep 'message-x
)
116 (gnus-harvest-install 'message-x
)
117 (gnus-harvest-install))))
119 (use-package orgalist
121 :hook
(message-mode .
(lambda ()
122 ;; work around incompatibility between
123 ;; orgalist and yasnippet
126 (yas-minor-mode 1))))
128 (provide 'bandali-message
)
129 ;;; bandali-message.el ends here