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.

Customizations

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

BBDB

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)
(setq
 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.

;; http://groups.google.com/group/gnu.emacs.gnus/browse_thread/thread/a673a74356e7141f
(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
      (concat
       "%0{%U%R%z%}"
       "%3{│%}" "%1{%d%}" "%3{│%}" ;; date
       "  "
       "%4{%-20,20f%}"               ;; name
       "  "
       "%3{│%}"
       " "
       "%1{%B%}"
       "%s\n"))
(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)
    (error
     (insert (with-temp-buffer (mm-insert-part handle) (buffer-string))
             "\n"))))

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
             '(org-src-block
               "^[ \t]*#\\+begin_"
               "^[ \t]*#\\+end_"
               my-mm-org-babel-src-extract
               nil))

(mm-uu-configure)

for debugging

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