summaryrefslogtreecommitdiffstats
path: root/lisp/bandali-message.el
blob: 491b6e290211efcd9c2907b5c844cb25af6885ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(use-package message
  :bind (:map message-mode-map ("<C-return>" . b/insert-asterism))
  :config
  ;; redefine for a simplified In-Reply-To header
  ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67)
  (defun message-make-in-reply-to ()
    "Return the In-Reply-To header for this message."
    (when message-reply-headers
      (let ((from (mail-header-from message-reply-headers))
            (msg-id (mail-header-id message-reply-headers)))
        (when from
          msg-id))))

  (defconst b/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:")
  (defconst message-cite-style-bandali
    '((message-cite-function  'message-cite-original)
      (message-citation-line-function  'message-insert-formatted-citation-line)
      (message-cite-reply-position 'traditional)
      (message-yank-prefix  "> ")
      (message-yank-cited-prefix  ">")
      (message-yank-empty-prefix  ">")
      (message-citation-line-format
       (if b/message-cite-say-hi
           (concat "Hi %F,\n\n" b/message-cite-style-format)
         b/message-cite-style-format)))
    "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
  (setq ;; message-cite-style 'message-cite-style-bandali
        message-kill-buffer-on-exit t
        message-send-mail-function 'message-send-mail-with-sendmail
        message-sendmail-envelope-from 'header
        message-subscribed-address-functions
        '(gnus-find-subscribed-addresses)
        message-dont-reply-to-names
        "\\(\\(amin@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)")
  ;; (require 'company-ebdb)
  :hook (;; (message-setup . mml-secure-message-sign-pgpmime)
         (message-mode . flyspell-mode)
         (message-mode . (lambda ()
                           ;; (setq-local fill-column b/fill-column
                           ;;             message-fill-column b/fill-column)
                           (eval-when-compile (defvar company-idle-delay))
                           (make-local-variable 'company-idle-delay)
                           (setq company-idle-delay 0.2))))
  ;; :custom-face
  ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
  ;; (message-header-to      ((t (:foreground "#111" :weight normal))))
  ;; (message-header-cc      ((t (:foreground "#333" :weight normal))))
  :custom
  (message-elide-ellipsis "[...]\n"))

(use-package footnote
  :after message
  ;; :config
  ;; (setq footnote-start-tag ""
  ;;       footnote-end-tag   ""
  ;;       footnote-style     'unicode)
  :bind
  (:map message-mode-map
        :prefix-map b/footnote-prefix-map
        :prefix "C-c f n"
        ("a" . footnote-add-footnote)
        ("b" . footnote-back-to-message)
        ("c" . footnote-cycle-style)
        ("d" . footnote-delete-footnote)
        ("g" . footnote-goto-footnote)
        ("r" . footnote-renumber-footnotes)
        ("s" . footnote-set-style)))

(provide 'bandali-message)