Move which-key footnote replacement to lisp/bandali-message.el.
[~bandali/configs] / lisp / bandali-message.el
CommitLineData
4c05c418
AB
1;;; bandali-message.el --- bandali's message.el setup -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2018-2020 Amin Bandali
4
5;; Author: Amin Bandali <bandali@gnu.org>
6;; Keywords: mail, news
7
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.
12
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.
17
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/>.
20
21;;; Commentary:
22
23;; My setup for message.el.
24
25;;; Code:
26
2087ae39
AB
27(use-package message
28 :bind (:map message-mode-map ("<C-return>" . b/insert-asterism))
29 :config
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)))
37 (when from
38 msg-id))))
39
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\\)\\|\\(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))))
70 ;; :custom-face
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))))
74 :custom
75 (message-elide-ellipsis "[...]\n"))
76
77(use-package footnote
78 :after message
076e9009 79 :config
2087ae39
AB
80 ;; (setq footnote-start-tag ""
81 ;; footnote-end-tag ""
82 ;; footnote-style 'unicode)
076e9009
AB
83 (when (featurep 'which-key)
84 (which-key-add-major-mode-key-based-replacements 'message-mode
85 "C-c f n" "footnote"))
2087ae39
AB
86 :bind
87 (:map message-mode-map
88 :prefix-map b/footnote-prefix-map
89 :prefix "C-c f n"
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)))
97
e2178fd3
AB
98(comment
99 (use-package message-x
100 :custom
101 (message-x-completion-alist
102 (quote
103 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address)
104 ((if
105 (boundp
106 (quote message-newgroups-header-regexp))
107 message-newgroups-header-regexp message-newsgroups-header-regexp)
108 . message-expand-group))))))
109
110(comment
111 (use-package gnus-harvest
112 :commands gnus-harvest-install
113 :demand
114 :config
115 (if (featurep 'message-x)
116 (gnus-harvest-install 'message-x)
117 (gnus-harvest-install))))
118
1eb20313
AB
119(use-package orgalist
120 :after message
121 :hook (message-mode . orgalist-mode))
122
2087ae39 123(provide 'bandali-message)
4c05c418 124;;; bandali-message.el ends here