dotfiles/emacs/.emacs.d/init/oni-gnus-init.org

3.7 KiB

Gnus is one of the most extensible Email programs on the planet. And it's not even made for email but NNTP.

  (require 'gnus)
  (require 'gnus-msg)
  (require 'mail-source)
  (require 'message)
  (require 'nnfolder)
  (require 'sendmail)

  (require 'oni-helpers)

Store all Gnus-related data in my data directory.

  (setq gnus-directory (oni:data-location "News")
        gnus-article-save-directory gnus-directory
        gnus-cache-directory gnus-directory
        gnus-kill-files-directory gnus-directory)

Store all Mail source-related data in my data directory.

  (setq mail-source-directory (oni:data-location "Mail"))

Store all message-related data in the same place as the Mail source data.

  (setq message-directory (oni:data-location "Mail"))

Store all nnfolder-related data in the same place as the Mail source data.

  (setq nnfolder-directory (oni:data-location "Mail"))

Use msmtp to send mail.

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

Tell Gnus I'm not a novice anymore. One of the features of Gnus I use a lot is deleting messages and as long as Gnus thinks I'm a novice it will ask me if I'm sure every single time.

  (setq gnus-novice-user nil)

Add a keybinding to the Gnus summary mode to easily delete messages.

  (define-key gnus-summary-mode-map (kbd "M-d") 'oni-gnus-delete-forward)

Change the Gnus group buffer line format.

  (setq gnus-group-line-format "%P%(%20G%): %-10s %S%p%B %5y %5T\n")

ryuslash.org

Set my main email address as the primary select method for Gnus.

  (setq gnus-select-method
        '(nnmaildir "ryuslash" (directory "~/documents/mail/ryuslash/")))

When sending mail from the ryuslash inbox, use the ryuslash msmtp account.

  (add-to-list 'gnus-posting-styles
               '(".*"
                 (address "tom@ryuslash.org")
                 (eval (setq message-sendmail-extra-arguments
                             '("-a" "ryuslash")))))

picturefix

Add my work email account as a secondary select method.

  (add-to-list 'gnus-secondary-select-methods
               '(nnmaildir "picturefix"
                           (directory "~/documents/mail/picturefix/")))

When sending mail from the picturefix account, use the picturefix msmtp account and set the proper name and email address.

  (add-to-list 'gnus-posting-styles
               '("picturefix:"
                 (name "Tom Willemsen")
                 (address "tom@picturefix.nl")
                 (eval (setq message-sendmail-extra-arguments
                             '("-a" "picturefix")))))

gmail

Add my other personal email as a secondary select method.

  (add-to-list 'gnus-secondary-select-methods
               '(nnmaildir "gmail"
                           (directory "~/documents/mail/gmail/")))

When sending mail from the gmail account, use the gmail msmtp accound and set the proper email address.

  (add-to-list 'gnus-posting-styles
               '("gmail:"
                 (name "Tom Willemse")
                 (address "ryuslash@gmail.com")
                 (eval (setq message-sendmail-extra-arguments
                             '("-a" "gmail")))))