summaryrefslogtreecommitdiff
path: root/lisp/news.el
blob: 8a9131ebaf018ae7191d2b435ed897f04ed169ee (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
;;; news.el -*- lexical-binding: t; -*-
;;;
;;; Author:  Jakob L. Kreuze <zerodaysfordays@sdf.org>
;;; URL:     https://git.sr.ht/~jakob/.emacs.d/
;;;
;;; Configuration for using Emacs as a newsreader.
;;;

;; Most of my Gnus configuration is in gnus.el, which is not under version
;; control because it contains a list of my accounts on various email servers.

;; Stop Gnus from making a mess of my home directory.

(setq gnus-init-file "~/.emacs.d/gnus.el"
      gnus-startup-file "~/.local/share/newsrc"
      gnus-read-newsrc-file nil
      gnus-save-newsrc-file nil
      gnus-directory "~/.local/share/gnus/news/"
      message-directory "~/.local/share/gnus/mail")

;; Sort articles such that newer items are at the top of the summary buffer.

(setq gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date))

;; Enable Flyspell so I don't make a fool of myself when composing messages.

(add-hook 'message-mode-hook #'flyspell-mode)

;; Use html2text to display HTML emails. Adapted from [1].
;;
;; [1]: https://norman.walsh.name/2011/03/10/w3m

(setq gnus-mime-display-multipart-related-as-mixed nil
      mm-inline-text-html-with-images t
      mm-text-html-renderer 'shr
      shr-use-colors nil
      shr-use-fonts nil)

;; Encrypt emails such that we can read them as well.

(setq mml-secure-openpgp-encrypt-to-self t)

;;; Interactive functions for calling mbsync(1).

(defvar mbsync-mailboxes '("Main:INBOX" "Main-Gmail:INBOX"
                           "Old:INBOX""University:INBOX")
  "List of mailboxes to sync with `sync-mail'.")

(defun sync-mail ()
  "Asynchronously run mbsync(1) on `mbsync-mailboxes'."
  (interactive)
  (let ((process (apply #'start-process "mbsync" nil "mbsync"
                        mbsync-mailboxes)))
    (message "Syncing mailboxes...")
    (set-process-sentinel process
                          #'(lambda (process event)
                              (ignore process)
                              (when (string= event "finished\n")
                                (message "Mailboxes synced."))))))

© 2015 - 2026 Jakob L. Kreuze