Starter Kit Gnus

This is part of the Emacs Starter Kit.

Starter Kit Gnus

Configuration for the notoriously difficult to configure Gnus email client

Unlike other starter-kit-*.org files, the gnus files will never be loaded by default. To use them, please copy either the Starter Kit Gnus IMAP for IMAP configuration, or Starter Kit Gnus POP for POP configuration into your user-specific directory, and then follow the instructions therein.


Once gnus is installed and working, here are some recommended Gnus customizations.


BBDBThe Insidious Big Brother Database is Emacs' contact manager which is very useful for keeping all of your contacts organized for use with gnus.

;;; bbdb
(require 'bbdb)
(require 'bbdb-autoloads)
 bbdb-file "~/.bbdb"
 bbdb-offer-save 'auto
 bbdb-notice-auto-save-file t
 bbdb-expand-mail-aliases t
 bbdb-canonicalize-redundant-nets-p t
 bbdb-always-add-addresses t
 bbdb-complete-name-allow-cycling t

More attractive Summary View

Thanks to Dan Davison.

(when window-system
  (setq gnus-sum-thread-tree-indent "  ")
  (setq gnus-sum-thread-tree-root "") ;; "● ")
  (setq gnus-sum-thread-tree-false-root "") ;; "◯ ")
  (setq gnus-sum-thread-tree-single-indent "") ;; "◎ ")
  (setq gnus-sum-thread-tree-vertical        "│")
  (setq gnus-sum-thread-tree-leaf-with-other "├─► ")
  (setq gnus-sum-thread-tree-single-leaf     "╰─► "))
(setq gnus-summary-line-format
       "%3{│%}" "%1{%d%}" "%3{│%}" ;; date
       "  "
       "%4{%-20,20f%}"               ;; name
       "  "
       " "
(setq gnus-summary-display-arrow t)

Org-mode code block fontification

Correctly fontify Org-mode attachments

(add-to-list 'mailcap-mime-extensions '(".org" . "text/org"))
(add-to-list 'mm-automatic-display "text/org")

(add-to-list 'mm-inline-media-tests
             '("text/org" my-display-org-inline
               (lambda (el) t)))

(defun my-display-org-inline (handle)
  (condition-case nil
      (mm-display-inline-fontify handle 'org-mode)
     (insert (with-temp-buffer (mm-insert-part handle) (buffer-string))

Update org-src-lang-modes to provide some leeway for posters

(add-to-list 'org-src-lang-modes
             '("elisp" . emacs-lisp))
(add-to-list 'org-src-lang-modes
             '("emacs_lisp" . emacs-lisp))

Fontify code blocks in the text of messages

(defun my-mm-org-babel-src-extract ()
  (mm-make-handle (mm-uu-copy-to-buffer start-point end-point) '("text/org")))

(add-to-list 'mm-uu-type-alist
               "^[ \t]*#\\+begin_"
               "^[ \t]*#\\+end_"


for debugging

(add-to-list 'mm-uu-configure-list '(org-src-block . disabled))
(setq mm-uu-configure-list
      (remove '(org-src-block . disabled) mm-uu-configure-list))