summary refs log tree commit diff
path: root/gnus.el
blob: 527203309df7c9bb1e55ffe13e341eb3022ab5d5 (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
;;; gnus.el -*- lexical-binding: t; -*-

(defvar +gnus--wconf nil)
(defvar +gnus-workspace-name "*gnus*")

(setq gnus-startup-file "~/Sync/gnus/newsrc")

(load! "gnus-article-treat-patch")
(require 'gnus-article-treat-patch)
(add-to-list 'gnus-article-patch-conditions "^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")

(setq gnus-select-method '(nnnil "")
      gnus-secondary-select-methods '((nnmaildir "Maildir" (directory "/home/terin/.nnmaildir"))))

(setq sendmail-program "msmtp"
      send-mail-function 'sendmail-send-it)

(defun =gnus ()
  "Activate `gnus' in its workspace."
  (interactive)
  (if (featurep! :ui workspaces)
      (progn
        (+workspace-switch +gnus-workspace-name t)
        (doom/switch-to-scratch-buffer)
        (gnus)
        (+workspace/display))
    (setq +gnus--wconf (current-window-configuration))
    (delete-other-windows)
    (switch-to-buffer (doom-fallback-buffer))
    (gnus)))

(defun +gnus-cleanup-h ()
  "Cleanup after a gnus session."
  (interactive)
  (if (and (featurep! :ui workspaces)
           (+workspace-exists-p +gnus-workspace-name))
      (+workspace/delete +gnus-workspace-name)
    (when (window-configuration-p +gnus--wconf)
      (set-window-configuration +gnus--wconf))
    (setq +gnus--wconf nil)
    (previous-buffer)))

(add-hook! 'gnus-exit-gnus-hook #'+gnus-cleanup-h)