summaryrefslogtreecommitdiff
path: root/gnus.org
blob: 736fa5714e21d40697d78b555c2a1c6268bc5320 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
#+PROPERTY: header-args:emacs-lisp :tangle tangle/gnus.el :noweb yes

#+begin_src shell :results silent :tangle tangle/symlink.sh :shebang "#!/bin/bash"
ln -siv $(pwd)/tangle/gnus.el ~/.gnus.el
#+end_src

Load private settings
#+begin_src emacs-lisp
(setq secret-file (expand-file-name "emacs-private.el.gpg"
				    user-emacs-directory))
(load secret-file)
#+end_src
* Config
** Servers
I use =imap= as my primary server. Setup some generic options:
#+begin_src emacs-lisp :noweb-ref imap :tangle no
nnimap ,@private/imap-info
(nnimap-stream ssl)
(nnir-search-engine imap)
#+end_src
Only fetch partial articles. This saves time on opening messages with
large attachments. Load any text based parts and also load any
signature if the message is signed. Unfortunately to correctly verify
the signature the full message needs to be loaded, which is why I
disabled partial fetching for now.
#+begin_src emacs-lisp :noweb-ref imap :tangle no
;; (nnimap-fetch-partial-articles "\\(text/\\|signature\\)")
#+end_src
Set my default inbox folder. This is the folder mail is split out of.
#+begin_src emacs-lisp :noweb-ref imap :tangle no
(nnimap-inbox "INBOX")
#+end_src
Use fancy splitting and setup splitting rules. See [[info:gnus#Fancy Mail Splitting][info:gnus#Fancy Mail Splitting]] for details.
#+begin_src emacs-lisp :noweb-ref imap :tangle no
(nnimap-split-methods nnimap-split-fancy)
(nnimap-split-fancy
 (| (: nnmail-split-fancy-with-parent)
    ,@private/imap-split-fancy
    "INBOX"
    ))
#+end_src

Noweb the primary server settings together.
#+begin_src emacs-lisp :noweb yes
(setq gnus-select-method
      `(
        <<imap>>
        ))
#+end_src

Setup a secondary imap server and a local nntp server I use to fetch
RSS/Atom Feeds asynchronously.
#+begin_src emacs-lisp
(add-to-list 'gnus-secondary-select-methods `(nnimap ,@private/personal-imap-info
                                                     (nnimap-stream ssl)
                                                     (nnir-search-engine imap)
                                                     (nnimap-inbox "INBOX")))
(add-to-list 'gnus-secondary-select-methods '(nntp "localhost" 4321))
<<secondary-select-methods>>
#+end_src
** Options
*** General
**** Startup
Load only groups with level < 2 for faster startup.
#+begin_src emacs-lisp
(setq gnus-activate-level 2)
#+end_src
**** Message related
Sent mails are read.
#+begin_src emacs-lisp
(setq gnus-gcc-mark-as-read t)
#+end_src
Save sent mails in my imap folder
#+begin_src emacs-lisp
(setq gnus-message-archive-method "dummy string")
(setq gnus-message-archive-group private/imap-sent-folder)
#+end_src
Enable responding to meeting invites.
#+begin_src emacs-lisp
(use-package gnus-icalendar
  :config
  (gnus-icalendar-setup)
  (setq gnus-icalendar-org-capture-file "~/sync/appointments.org")
  (setq gnus-icalendar-org-capture-headline '("Calendar")) ;;make sure to create Calendar heading first
  (gnus-icalendar-org-setup)
  )
#+end_src
Enable message delaying (scheduling)
#+begin_src emacs-lisp
(gnus-delay-initialize)
#+end_src
***** BBDB integration
Enable =mail-aliases= and create aliases for all mail adresses if an entry has multiple.
#+begin_src emacs-lisp
(add-hook 'message-setup-hook 'bbdb-mail-aliases)
(setq bbdb-mail-alias 'all)
#+end_src
***** Mail encryption & signing
Verify mail signatures with known protocols.
#+begin_src emacs-lisp
(setq mm-verify-option 'known)
#+end_src
Show buttons for result of signature verification & for multipart mails. To show the message fully buttonized use =K b= in the summary buffer.
#+begin_src emacs-lisp
(setq gnus-buttonized-mime-types '("multipart/signed" "multipart/alternative"))
#+end_src
**** Mail splitting
Setup for fancy mail splitting. Also see the parameters in ~gnus-select-method~.
#+begin_src emacs-lisp
(setq nnmail-split-methods 'nnimap-split-fancy)

(setq nnmail-cache-accepted-message-ids t)
(setq nnmail-message-id-cache-length 10000)
#+end_src
**** Demon
Background fetching for gnus. See the manual and [[https://www.emacswiki.org/emacs/GnusDemon][emacswiki]].
#+begin_src emacs-lisp
(defun gnus-demon-scan-news-level (level only)
  (let ((win (current-window-configuration))
	(gnus-read-active-file 'some)
	(gnus-check-new-newsgroups nil)
	(gnus-verbose 2)
	(gnus-verbose-backends 5))
    (while-no-input
      (unwind-protect
          (save-window-excursion
            (when (gnus-alive-p)
              (with-current-buffer gnus-group-buffer
                (gnus-group-get-new-news level only))))
        (set-window-configuration win)))))
(defun gnus-demon-scan-news-2 ()
  (gnus-demon-scan-news-level 2 nil))
(defun gnus-demon-scan-news-3 ()
  (gnus-demon-scan-news-level 3 t))
(defun gnus-demon-scan-news-4 ()
  (gnus-demon-scan-news-level 4 t))
(defun gnus-demon-scan-news-5 ()
  (gnus-demon-scan-news-level 5 t))

(setq gnus-demon-timestep 10)
(gnus-demon-add-handler 'gnus-demon-scan-news-2 3 nil)
(gnus-demon-add-handler 'gnus-demon-scan-news-3 60 t)
(gnus-demon-add-handler 'gnus-demon-scan-news-4 130 1)
(gnus-demon-add-handler 'gnus-demon-scan-news-5 140 1)
#+end_src
**** Adaptive scoring
See [[info:gnus#Adaptive Scoring][info:gnus#Adaptive Scoring]] and this [[https://notes.whatthefuck.computer/1417593600.0-note.html][blog post]] by Ryan Rix.
***** Score File Setup
#+begin_src emacs-lisp
(setq gnus-use-adaptive-scoring '(word line))
(setq gnus-adaptive-word-length-limit 5)
(setq gnus-adaptive-word-no-group-words t)
(setq gnus-summary-mark-below -300)
(setq gnus-default-adaptive-score-alist
      '(
        <<gnus-adaptive-scoring-wo-from>>))
(setq gnus-default-adaptive-word-score-alist
      `((,gnus-read-mark . 5)
        (,gnus-catchup-mark . -5)
        (,gnus-killed-mark . -15)
        (,gnus-del-mark . -10))
      )
;; (setq gnus-adaptive-word-score-alist gnus-default-adaptive-word-score-alist)
#+end_src
****** Using different (adaptive) scoring files for different groups
To define different adaptive scoring files for different groups I set [[info:gnus#Home Score File][home score files]] based on the group name.
#+begin_src emacs-lisp
(setq gnus-home-score-file
      '(("^nnimap" "nnimap.SCORE") ;; w/ author scoring
        ("gmane" "nntp_gmane.SCORE") ;; w/ author scoring
        ("^nntp\\+localhost" "nntp_global.SCORE") ;; w/o author scoring
        ))
(setq gnus-home-adapt-file
      '(("^nnimap" "nnimap.ADAPT")
        ("gmane" "nntp_gmane.ADAPT")
        ("^nntp\\+localhost" "nntp_global.ADAPT")))
#+end_src
Scoring based on the =from= header does not make sense for rss feeds with only one author or newsgroups with unset author. These files therefore contain my default adaptive scoring rules with or without =from= scoring.
#+NAME: gnus-adaptive-scoring-w-from
#+begin_src emacs-lisp :tangle no :eval never
(gnus-unread-mark)
(gnus-ticked-mark (from 4))
(gnus-dormant-mark (from 5))
(gnus-del-mark (from -4) (subject -50))
(gnus-read-mark (from 5) (subject 100))
(gnus-expirable-mark)
(gnus-killed-mark (from -5) (subject -300) (followup -150))
(gnus-kill-file-mark)
(gnus-ancient-mark)
(gnus-low-score-mark)
(gnus-catchup-mark (from -2) (subject -40))
#+end_src
#+NAME: gnus-adaptive-scoring-wo-from
#+begin_src emacs-lisp :tangle no :eval never
(gnus-unread-mark)
(gnus-ticked-mark)
(gnus-dormant-mark)
(gnus-del-mark (subject -50))
(gnus-read-mark (subject 100))
(gnus-expirable-mark)
(gnus-killed-mark (subject -300) (followup -150))
(gnus-kill-file-mark)
(gnus-ancient-mark)
(gnus-low-score-mark)
(gnus-catchup-mark (subject -40))
#+end_src
Unfortunately setting these on a per group basis does not work currently as it would (at least) override the word scoring setting. So I stick with the same adaptive scoring rules for all groups set above.
***** Misc Options
To ensure filenames compatible with Windows and stuff:
#+begin_src emacs-lisp
(setq nnheader-file-name-translation-alist '((?: . ?_) (?[ . ?_) (?] . ?_)))
#+end_src

Slow scoring decay prevents huge scores from building up. Only run on =.ADAPT= score files and decay each scoring rule by 1 point or 1%, whichever is larger.
#+begin_src emacs-lisp
(setq gnus-decay-scores "\\.ADAPT\\'"
      gnus-score-decay-constant 1
      gnus-score-decay-scale 0.01)
#+end_src
****** Ignored Words
Do not score on some common german words. I extracted these from my score file after a few weeks of using scoring.
#+begin_src emacs-lisp
(setq gnus-ignored-adaptive-words
      '("loswerden" "teilweise" "übernahme" "betrieb" "kündigt" "schnittstelle" "abgewendet" "hälfte" "massiv" "massivst" "angeblich" "verschleppt" "startup" "auslistung" "wichtiger" "öffentliches" "verwenden" "asynchron" "lieber" "arbeite" "zahlreiche" "november" "entscheidung" "käufer" "findet" "mittlere" "vorstoß" "starker" "erreicht" "letzte" "geplant" "september" "nachfolger" "ankündigen" "mildern" "antrieb" "lassen" "aufsteigen" "entdeckt" "hinweise" "bedingungen" "miniserie" "funktioniert" "umfragen" "angreifbare" "fiasko" "prüfstand" "sparsamer" "steigt" "zugangsdaten" "tutorial" "details" "verfahren" "verschiebt" "enorme" "schlechtere" "erwarten" "optimierungen" "aushalten" "kratzer" "stürze" "gelöscht" "getestet" "stalker" "showcase" "warnung" "maßnahmenplan" "konstruieren" "deutsches" "großen" "probefahrt" "interesse" "preise" "verteilt" "leaken" "günstiger" "umgerüstet" "ausflug" "edition" "definitive" "schützen" "zeiten" "größte" "sicherer" "falsches" "schnelles" "wollte" "angebunden" "externe" "aktualisiertes" "zweiten" "limitiert" "überraschend" "unsicher" "schonfrist" "strukturiert" "historisches" "riesige" "gründet" "mitarbeiter" "geleakt" "mutmaßlichem" "idiotensicher" "stunden" "zornige" "schwächer" "funktionierende" "meinen" "meisten" "geringer" "gewinnen" "rennen" "halten" "synchronisation" "normal" "riesiges" "bessere" "enthält" "integriert" "project" "zurücknehmen" "verursacht" "bleibt" "angeschlossene" "verbrauchen" "berichtet" "ausmachen" "unterschied" "stoppen" "weiterhin" "ausschluss" "schaffen" "exklusives" "riesiger" "keinen" "verbesserter" "steckt" "kündigen" "dienste" "erwägt" "dürfen" "demonstriert" "unerlaubter" "möglichkeiten" "unendlicher" "unbegrenzte" "vermehrt" "greift" "veröffentlicht" "komplett" "warten" "blockiert" "freier" "erscheinen" "reicht" "fliegen" "eigene" "erweitert" "sollen" "könnte" "erscheint" "können" "arbeiten" "eigenen" "lieferbar" "kostet" "kommen" "startet" "zurück" "bestätigt" "schnell" "bietet" "unterstützen" "zahlen" "bekommt" "ersten" "schneller" "verkauft" "kaufen" "machen" "vorgestellt" "bringt" "offenbar" "geräte" "präsentiert" "videos" "stellt" "schließt" "werden" "erhält" "wieder" "endlich" "verfügbar" "deutsche"
        ))
#+end_src
**** Registry
Use the [[info:gnus#The Gnus Registry][Gnus Registry]]. This is required to use [[id:990e2668-11d6-45eb-9c9b-1dc0b89b556d][Gnorb]].
#+begin_src emacs-lisp
(gnus-registry-initialize)
#+end_src
#+begin_src emacs-lisp :tangle no :noweb-ref secondary-select-methods
(add-to-list 'gnus-secondary-select-methods '(nngnorb "Gnorb server"))
#+end_src
Enable gnorb tracking
#+begin_src emacs-lisp
(gnorb-tracking-initialize)
#+end_src
Hint for existing relevant tracked conversations in the summary buffer (see [[info:gnorb#Hinting in Gnus][info:gnorb#Hinting in Gnus]]). Already tracked messages are marked with =&= and new maybe relevant messages with =¡=.
#+begin_src fundamental :tangle no :noweb-ref gnorb-summary-line-format
%ug
#+end_src
Display [[info:gnorb#Tagging Messages and Contacts][message tags]] in the summary line. Stop other summary line content at column 120 and insert the tags after.
#+begin_src fundamental :tangle no :noweb-ref gnorb-summary-tags
%-120=%uG
#+end_src
Also automatically set message tags
#+begin_src emacs-lisp
(setq gnorb-gnus-auto-tag-messages t)
#+end_src
**** Gnus Cloud
The [[info:gnus#The Gnus Cloud][Gnus Cloud]] lets you synchronize marks and general data (whatever that is) across different machines. This seems more complete than manually (with Nextcloud, …) syncing the news related files (=~/.newsrc.eld=, =~/News=, …).

To enable it go to the gnus server buffer and mark the servers to be synced with =i= and the (imap) server which is used as host with =I=.
#+begin_src emacs-lisp
(setq gnus-cloud-method (concat "nnimap:" (car private/personal-imap-info)))
#+end_src
Commands to interact with the gnus cloud are prefixed with =~= in the group buffer.
#+begin_src emacs-lisp
(setq gnus-cloud-synced-files '("~/.authinfo.gpg" "~/.gnus.registry.eieio" (:directory "~/News" :match ".*.\\(SCORE\\|ADAPT\\)")))
#+end_src
*** Display
Sort by newest first
#+begin_src emacs-lisp
(setq gnus-article-sort-functions '((not gnus-thread-sort-by-date))
      gnus-thread-sort-functions  '((not gnus-thread-sort-by-date)))
#+end_src
Unicode reply symbol
#+begin_src emacs-lisp
(setq gnus-summary-to-prefix "→ ")
#+end_src
**** On threads
Gather loose threads, whose parent is currently not displayed, under a
dummy article. I find the default ~'adopt~ to be too confusing.
#+begin_src emacs-lisp
(setq gnus-summary-make-false-root 'dummy)
(setq gnus-summary-dummy-line-format "  %(:                                    :%) %S
")
(setq gnus-summary-make-false-root-always t)
#+end_src
Also try to connect threads by guessing which articles are missing
#+begin_src emacs-lisp
(setq gnus-fetch-old-headers nil)
(setq gnus-build-sparse-threads 'more)
#+end_src
Better thread display (from [[https://www.emacswiki.org/emacs/GnusFormatting][emacswiki/GnusFormatting)]].
#+begin_src emacs-lisp
(setq gnus-summary-line-format (concat "%U%R%z"
                                      "<<gnorb-summary-line-format>>"
                                      " %(%&user-date;  %-15,15f  %B%s%) "
                                      "<<gnorb-summary-tags>>" "\n")
     gnus-user-date-format-alist '((t . "%y-%m-%d %H:%M"))
     gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references
     gnus-sum-thread-tree-false-root ""
     gnus-sum-thread-tree-indent " "
     gnus-sum-thread-tree-leaf-with-other "├► "
     gnus-sum-thread-tree-root ""
     gnus-sum-thread-tree-single-leaf "╰► "
     gnus-sum-thread-tree-vertical "│")
#+end_src
**** Topics
Disable indenting a topic. I always do it by accident.
#+begin_src emacs-lisp
(use-package gnus-topic
  :config
  (defun fpi/gnus-topic-toggle-topic ()
    "Toggle display of the topic."
    (interactive)
    (when (gnus-group-topic-p)
      (if (equal 'visible
                 (nth 1 (cadr (gnus-topic-find-topology (gnus-current-topic)))))
          (gnus-topic-hide-topic)
        (gnus-topic-show-topic))))
  (define-key gnus-topic-mode-map (kbd "<tab>") 'fpi/gnus-topic-toggle-topic)
  (define-key gnus-topic-mode-map (kbd "TAB") 'fpi/gnus-topic-toggle-topic))
#+end_src
Function to toggle display of group levels in the group buffer.
#+begin_src emacs-lisp
(defvar gnus-group-line-format-wo-levels nil)
(defun fpi/gnus-group-toggle-levels ()
  (interactive)
  (if gnus-group-line-format-wo-levels
      (setq gnus-group-line-format gnus-group-line-format-wo-levels
            gnus-group-line-format-wo-levels nil)
    (setq gnus-group-line-format-wo-levels gnus-group-line-format
          gnus-group-line-format (concat "[%L] " gnus-group-line-format)))
  ;; Hack to update display
  (gnus-group-get-new-news 0))
(define-key gnus-topic-mode-map (kbd "T L") 'fpi/gnus-group-toggle-levels)
#+end_src
**** Window Layout
See [[info:gnus#Window Layout][info:gnus#Window Layout]].
#+begin_src emacs-lisp
(setq gnus-use-full-window nil)
#+end_src
**** Modeline indicator
From the [[https://www.emacswiki.org/emacs/GnusNotify][emacswiki Gnus Notify]].
#+begin_quote
[…] use ~G p~ in the group buffer, then add ~(modeline-notify t)~ […]
#+end_quote
Activate with [[elisp:gnus-mst-show-groups-with-new-messages]].
Code:
#+begin_src emacs-lisp
;;; gnus-notify.el --- use the modeline to indicate groups with new messages

;; Author: Mark Triggs <mark@dishevelled.net>
;;
;; Contributions from: Frederic Couchet <fcouchet AT april.org>

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;; This code provides modeline notification of when certain groups contain
;; unread messages. Groups for whom unread messages should be indicated are
;; chosen by setting a group parameter.

;; Clicking on a group in the modeline will enter that group and view the new
;; message.

;; Code:

(require 'cl-lib)

(defvar gnus-notify-show-unread-counts t
  "If true, show the number of unread messages in the modeline in addition to shortened group names.")


(when (fboundp 'gnus-define-group-parameter)
  (gnus-define-group-parameter
   modeline-notify
   :type bool
   :parameter-type '(const :tag "Notify of new messages for this group." t)
   :parameter-document "\

If this is set, the name of this group will be placed on the modeline when it
contains new messages"))

(defvar gnus-mst-display-new-messages "")
(defvar gnus-mst-notify-groups '())
(defvar gnus-notify-jump-to-group-hook '()
  "This hook is invoked before jumping to a gnus group with unread messages.
  Each hook should take a single argument - the GROUP to be selected")


(add-hook 'gnus-exit-gnus-hook
          (lambda ()
            (setq gnus-mst-display-new-messages "")))


(defun gnus-mst-notify-modeline-form ()
  gnus-mst-display-new-messages)


(if (featurep 'xemacs)
    (unless (member 'gnus-mst-display-new-messages global-mode-string)
      (if (null global-mode-string)
          (setq global-mode-string '("" gnus-mst-display-new-messages))
        (setq global-mode-string
              (append global-mode-string
                      '(gnus-mst-display-new-messages)))))
  (unless (member '(:eval (gnus-mst-notify-modeline-form)) global-mode-string)
    (setq global-mode-string
          (append global-mode-string
                  (list '(:eval (gnus-mst-notify-modeline-form)))))))


(defun gnus-mst-notify-shorten-group-name (group)
  "shorten the group name to make it better fit on the modeline"
  (let ((name (if (string-match ":" group)
                  (cadr (split-string group "[:]"))
                group)))
    (mapconcat 'identity
               (mapcar
                (lambda (segment)
                  (string (elt segment 0)))
                (split-string name "[\\./]"))
               ".")))


(defun gnus-mst-notify-update-modeline ()
  "Update the modeline to show groups containing new messages"
  (if gnus-mst-notify-groups
      (setq gnus-mst-display-new-messages
            (append (list " [m: ")
                    (cl-maplist
                     (lambda (sublist)
                       (let ((group (car sublist))
                             (map (make-sparse-keymap)))
                         (define-key map [mode-line mouse-1]
                           `(lambda ()
                              (interactive)
                              (run-hook-with-args
                               'gnus-notify-jump-to-group-hook ,group)
                              (gnus-group-read-group nil nil ,group)))
                         (cl-list*
                          (list ':propertize
                                (if gnus-notify-show-unread-counts
                                    (format "[%s %s]"
                                            (gnus-mst-notify-shorten-group-name
                                             (car sublist))
                                            (gnus-group-unread (car sublist)))
                                  (format "%s"
                                          (gnus-mst-notify-shorten-group-name
                                           (car sublist))))
                                'face 'bold
                                'keymap map
                                'help-echo "Visit this group")
                          (if (cdr sublist)
                              (list ", ")
                            nil))))
                     gnus-mst-notify-groups)
                    (list "] ")))
    (setq gnus-mst-display-new-messages "")))


(defun gnus-mst-notify-group (group)
  "Add notification for this group"
  (unless (member group gnus-mst-notify-groups)
    (add-to-list 'gnus-mst-notify-groups group t)
    (gnus-mst-notify-update-modeline)))


(defun gnus-mst-show-groups-with-new-messages (&rest ignored)
  (interactive)
  (setq gnus-mst-notify-groups '())
  (gnus-mst-notify-update-modeline)
  (mapc #'(lambda (g)
           (let* ((group (car g))
                  (unread (gnus-group-unread group)))
             (when (and (cdr (assoc 'modeline-notify
                                    (gnus-group-find-parameter group)))
                        (and (numberp unread) (> unread 0)))
               (gnus-mst-notify-group group))))
        gnus-newsrc-alist))


(add-hook 'gnus-after-getting-new-news-hook
          'gnus-mst-show-groups-with-new-messages)


(add-hook 'gnus-summary-exit-hook
          'gnus-mst-show-groups-with-new-messages)


(provide 'gnus-notify)
;;; gnus-notify.el ends here
#+end_src
*** Misc
Workaround for bug with ~gnus-cloud-method~ and ~custom-variable-recalc-variable~ upon reloading the =spacemacs-*= theme.
#+begin_src emacs-lisp
(setq server "nnimap:imsmail")
#+end_src
**** nnreddit
#+begin_src emacs-lisp
(use-package nnreddit
  :straight t)
(add-to-list 'gnus-secondary-select-methods '(nnreddit ""))
#+end_src