aboutsummaryrefslogtreecommitdiff
path: root/bard-emacs-modules/bard-emacs-email.el
blob: e898fa3c6075deff7b29d67703ad539213384f5f (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
;; General `notmuch' ui configuration

(use-package notmuch
  :ensure t
  :config
  (define-key global-map (kbd "C-c m") #'notmuch))

(use-package notmuch-indicator
  :ensure t
  :after notmuch
  :config
  (setq notmuch-indicator-args
        '(( :terms "tag:unread and tag:inbox"
            :label "[U] "
            :label-face prot-modeline-indicator-green
            :counter-face prot-modeline-indicator-green)
          ( :terms "tag:unread and tag:linux"
            :label "[L] "
            :label-face prot-modeline-indicator-cyan
            :counter-face prot-modeline-indicator-cyan)
          ( :terms "tag:unread and tag:emacs"
            :label "[E] "
            :label-face prot-modeline-indicator-blue
            :counter-face prot-modeline-indicator-blue))

        notmuch-indicator-refresh-count (* 60 3)
        notmuch-indicator-hide-empty-counters t
        notmuch-indicator-force-refresh-commands '(notmuch-refresh-this-buffer))
  (setq notmuch-indicator-add-to-mode-line-misc-info nil)
  (notmuch-indicator-mode t))

;; use msmtp
(setq message-send-mail-function 'message-send-mail-with-sendmail)
(setq sendmail-program "/usr/bin/msmtp")

(setq notmuch-show-logo t
      notmuch-column-control 1.0
      notmuch-hello-auto-refresh t
      notmuch-hello-recent-searches-max 20
      notmuch-hello-thousands-separator ""
      notmuch-hello-sections '(notmuch-hello-insert-header notmuch-hello-insert-saved-searches notmuch-hello-insert-search notmuch-hello-insert-alltags)
      notmuch-show-all-tags-list t)

(setq notmuch-search-oldest-first nil)
(setq notmuch-show-seen-current-message t)

(defun bard/notmuch-mua-empty-subject-check ()
  "Request confirmation before sending a message with empty subject."
  (when (and (null (message-field-value "Subject"))
             (not (y-or-n-p "Subject is empty, send anyway? ")))
    (error "Sending message cancelled: empty subject")))
(add-hook 'message-send-hook 'bard/notmuch-mua-empty-subject-check)

(setq notmuch-show-empty-saved-searches t)
(setq notmuch-saved-searches
      `(( :name "📥 inbox"
          :query "tag:inbox"
          :sort-order newest-first
          :key ,(kbd "i"))
        ( :name "💬 unread (inbox)"
          :query "tag:unread and tag:inbox"
          :sort-order newest-first
          :key ,(kbd "u"))
        ( :name "🐃 contrib"
          :query "tag:unread and tag:contrib"
          :sort-order newest-first
          :key ,(kbd "c"))
        ( :name "🐧 linux"
          :query "tag:unread and tag:linux"
          :sort-order newest-first
          :key ,(kbd "l"))
        ( :name "🚂 emacs devel"
          :query "tag:unread and tag:contrib"
          :sort-order newest-first
          :key ,(kbd "ed"))
        ( :name "🎨 emacs humanities"
          :query "tag:unread and tag:emacs-humanities"
          :sort-order newest-first
          :key ,(kbd "eh"))
        ( :name "🦄 emacs org"
          :query "tag:unread and tag:emacs-org"
          :sort-order newest-first
          :key ,(kbd "eo"))))

(setq notmuch-tagging-keys
      `((,(kbd "d") prot-notmuch-mark-delete-tags "💥 Mark for deletion")
        (,(kbd "f") prot-notmuch-mark-flag-tags "🚩 Flag as important")
        (,(kbd "s") prot-notmuch-mark-spam-tags "🔥 Mark as spam")
        (,(kbd "r") ("-unread") "👁️‍🗨️ Mark as read")
        (,(kbd "u") ("+unread") "🗨️ Mark as unread")))

(setq notmuch-archive-tags '("+archive")
      notmuch-message-replied-tags '("+replied")
      notmuch-message-forwarded-tags '("+forwarded")
      notmuch-show-mark-read-tags '("-unread")
      notmuch-draft-tags '("+draft")
      notmuch-draft-folder "drafts"
      notmuch-draft-save-plaintext 'ask)

(provide 'bard-emacs-email)