Move Gnus config to separate file

This commit is contained in:
Tom Willemse 2016-10-19 21:04:23 +02:00
parent a0b9627c7f
commit 5a665e317c
2 changed files with 133 additions and 142 deletions

View file

@ -927,149 +927,12 @@ To start off, first I need to enable lexical binding.
(with-eval-after-load 'ediff (load "oni-ediff-init"))
#+END_SRC
** Gnus
- [[file:init/oni-gnus-init.org][Gnus]] :: Gnus is one of the most extensible Email programs on the
planet.
Gnus is one of the most extensible Email programs on the
planet. And it's not even made for email but NNTP.
Store all Gnus-related data in my data directory.
#+BEGIN_SRC emacs-lisp
(eval-when-compile (require 'gnus))
(with-eval-after-load 'gnus
(setq gnus-directory (oni:data-location "News")
gnus-article-save-directory gnus-directory
gnus-cache-directory gnus-directory
gnus-kill-files-directory gnus-directory))
#+END_SRC
Store all Mail source-related data in my data directory.
#+BEGIN_SRC emacs-lisp
(eval-when-compile (require 'mail-source))
(with-eval-after-load 'mail-source
(setq mail-source-directory (oni:data-location "Mail")))
#+END_SRC
Store all message-related data in the same place as the Mail source
data.
#+BEGIN_SRC emacs-lisp
(eval-when-compile (require 'message))
(with-eval-after-load 'message
(setq message-directory (oni:data-location "Mail")))
#+END_SRC
Store all nnfolder-related data in the same place as the Mail
source data.
#+BEGIN_SRC emacs-lisp
(eval-when-compile (require 'nnfolder))
(with-eval-after-load 'nnfolder
(setq nnfolder-directory (oni:data-location "Mail")))
#+END_SRC
Use msmtp to send mail.
#+BEGIN_SRC emacs-lisp
(eval-when-compile (require 'sendmail))
(with-eval-after-load 'sendmail
(setq send-mail-function 'sendmail-send-it)
(setq sendmail-program "/usr/bin/msmtp"))
#+END_SRC
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.
#+BEGIN_SRC emacs-lisp
(setq gnus-novice-user nil)
#+END_SRC
Add a keybinding to the Gnus summary mode to easily delete
messages.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'gnus
(define-key gnus-summary-mode-map (kbd "M-d") 'oni-gnus-delete-forward))
#+END_SRC
*** ryuslash.org
Set my main email address as the primary select method for Gnus.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'gnus
(setq gnus-select-method
'(nnmaildir "ryuslash" (directory "~/documents/mail/ryuslash/"))))
#+END_SRC
When sending mail from the ryuslash inbox, use the ryuslash msmtp
account.
#+BEGIN_SRC emacs-lisp
(eval-when-compile (require 'gnus-msg))
(with-eval-after-load 'gnus-msg
(add-to-list 'gnus-posting-styles
'(".*"
(address "tom@ryuslash.org")
(eval (setq message-sendmail-extra-arguments
'("-a" "ryuslash"))))))
#+END_SRC
*** picturefix
Add my work email account as a secondary select method.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'gnus
(add-to-list 'gnus-secondary-select-methods
'(nnmaildir "picturefix"
(directory "~/documents/mail/picturefix/"))))
#+END_SRC
When sending mail from the picturefix account, use the picturefix
msmtp account and set the proper name and email address.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'gnus-msg
(add-to-list 'gnus-posting-styles
'("picturefix:"
(name "Tom Willemsen")
(address "tom@picturefix.nl")
(eval (setq message-sendmail-extra-arguments
'("-a" "picturefix"))))))
#+END_SRC
*** gmail
Add my other personal email as a secondary select method.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'gnus
(add-to-list 'gnus-secondary-select-methods
'(nnmaildir "gmail"
(directory "~/documents/mail/gmail/"))))
#+END_SRC
When sending mail from the gmail account, use the gmail msmtp
accound and set the proper email address.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'gnus-msg
(add-to-list 'gnus-posting-styles
'("gmail:"
(name "Tom Willemse")
(address "ryuslash@gmail.com")
(eval (setq message-sendmail-extra-arguments
'("-a" "gmail"))))))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'gnus (load "oni-gnus-init"))
#+END_SRC
** Linewise user-interface

View file

@ -0,0 +1,128 @@
Gnus is one of the most extensible Email programs on the
planet. And it's not even made for email but NNTP.
#+BEGIN_SRC emacs-lisp
(require 'gnus)
(require 'gnus-msg)
(require 'mail-source)
(require 'message)
(require 'nnfolder)
(require 'sendmail)
(require 'oni-helpers)
#+END_SRC
Store all Gnus-related data in my data directory.
#+BEGIN_SRC emacs-lisp
(setq gnus-directory (oni:data-location "News")
gnus-article-save-directory gnus-directory
gnus-cache-directory gnus-directory
gnus-kill-files-directory gnus-directory)
#+END_SRC
Store all Mail source-related data in my data directory.
#+BEGIN_SRC emacs-lisp
(setq mail-source-directory (oni:data-location "Mail"))
#+END_SRC
Store all message-related data in the same place as the Mail source
data.
#+BEGIN_SRC emacs-lisp
(setq message-directory (oni:data-location "Mail"))
#+END_SRC
Store all nnfolder-related data in the same place as the Mail
source data.
#+BEGIN_SRC emacs-lisp
(setq nnfolder-directory (oni:data-location "Mail"))
#+END_SRC
Use msmtp to send mail.
#+BEGIN_SRC emacs-lisp
(setq send-mail-function 'sendmail-send-it)
(setq sendmail-program "/usr/bin/msmtp")
#+END_SRC
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.
#+BEGIN_SRC emacs-lisp
(setq gnus-novice-user nil)
#+END_SRC
Add a keybinding to the Gnus summary mode to easily delete
messages.
#+BEGIN_SRC emacs-lisp
(define-key gnus-summary-mode-map (kbd "M-d") 'oni-gnus-delete-forward)
#+END_SRC
* ryuslash.org
Set my main email address as the primary select method for Gnus.
#+BEGIN_SRC emacs-lisp
(setq gnus-select-method
'(nnmaildir "ryuslash" (directory "~/documents/mail/ryuslash/")))
#+END_SRC
When sending mail from the ryuslash inbox, use the ryuslash msmtp
account.
#+BEGIN_SRC emacs-lisp
(add-to-list 'gnus-posting-styles
'(".*"
(address "tom@ryuslash.org")
(eval (setq message-sendmail-extra-arguments
'("-a" "ryuslash")))))
#+END_SRC
* picturefix
Add my work email account as a secondary select method.
#+BEGIN_SRC emacs-lisp
(add-to-list 'gnus-secondary-select-methods
'(nnmaildir "picturefix"
(directory "~/documents/mail/picturefix/")))
#+END_SRC
When sending mail from the picturefix account, use the picturefix
msmtp account and set the proper name and email address.
#+BEGIN_SRC emacs-lisp
(add-to-list 'gnus-posting-styles
'("picturefix:"
(name "Tom Willemsen")
(address "tom@picturefix.nl")
(eval (setq message-sendmail-extra-arguments
'("-a" "picturefix")))))
#+END_SRC
* gmail
Add my other personal email as a secondary select method.
#+BEGIN_SRC emacs-lisp
(add-to-list 'gnus-secondary-select-methods
'(nnmaildir "gmail"
(directory "~/documents/mail/gmail/")))
#+END_SRC
When sending mail from the gmail account, use the gmail msmtp
accound and set the proper email address.
#+BEGIN_SRC emacs-lisp
(add-to-list 'gnus-posting-styles
'("gmail:"
(name "Tom Willemse")
(address "ryuslash@gmail.com")
(eval (setq message-sendmail-extra-arguments
'("-a" "gmail")))))
#+END_SRC