* init.el(b/duplicate-line-or-region): New convenience function.
[~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
79 ;; :config
80 ;; (setq footnote-start-tag ""
81 ;; footnote-end-tag ""
82 ;; footnote-style 'unicode)
83 :bind
84 (:map message-mode-map
85 :prefix-map b/footnote-prefix-map
86 :prefix "C-c f n"
87 ("a" . footnote-add-footnote)
88 ("b" . footnote-back-to-message)
89 ("c" . footnote-cycle-style)
90 ("d" . footnote-delete-footnote)
91 ("g" . footnote-goto-footnote)
92 ("r" . footnote-renumber-footnotes)
93 ("s" . footnote-set-style)))
94
e2178fd3
AB
95(use-package message-x)
96
97(comment
98 (use-package message-x
99 :custom
100 (message-x-completion-alist
101 (quote
102 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address)
103 ((if
104 (boundp
105 (quote message-newgroups-header-regexp))
106 message-newgroups-header-regexp message-newsgroups-header-regexp)
107 . message-expand-group))))))
108
109(comment
110 (use-package gnus-harvest
111 :commands gnus-harvest-install
112 :demand
113 :config
114 (if (featurep 'message-x)
115 (gnus-harvest-install 'message-x)
116 (gnus-harvest-install))))
117
2087ae39 118(provide 'bandali-message)
4c05c418 119;;; bandali-message.el ends here