aboutsummaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d/init.org
diff options
context:
space:
mode:
authorGravatar Tom Willemse2018-01-01 16:49:54 -0800
committerGravatar Tom Willemse2018-01-01 16:49:54 -0800
commita8501755558988b401128f643863aaf049c4472a (patch)
tree87c2b88b65c839cbad4a7ecc529daec9bad7ac3e /emacs/.emacs.d/init.org
parent9ae6f7f1be4b480506eb39c1c1c298efa7fe6e00 (diff)
downloadnew-dotfiles-a8501755558988b401128f643863aaf049c4472a.tar.gz
new-dotfiles-a8501755558988b401128f643863aaf049c4472a.zip
Move gnus init to main org file
Diffstat (limited to 'emacs/.emacs.d/init.org')
-rw-r--r--emacs/.emacs.d/init.org131
1 files changed, 131 insertions, 0 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index fab9b4d..eec029a 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -1406,6 +1406,137 @@ Computing Environment".
(add-hook 'jabber-chat-mode-hook 'oni:set-default-directory)
#+END_SRC
+** Gnus
+ :PROPERTIES:
+ :header-args: :tangle "init/oni-gnus-init.el"
+ :END:
+
+ Gnus is the very extensible Emacs news reader, which just happens
+ to also function very well as a mail reader. Since it is so
+ extensible and also configurable the configuration for it tends to
+ get big, so I split it into a separate file.
+
+ #+BEGIN_SRC emacs-lisp :tangle yes
+ (with-eval-after-load 'gnus (load "oni-gnus-init"))
+ #+END_SRC
+
+ Configuring Gnus is actually configuring a handful of packages, so
+ I require them all when Gnus is loaded so the byte compiler won't
+ yell at me.
+
+ #+BEGIN_SRC emacs-lisp
+ (require 'gnus)
+ (require 'gnus-msg)
+ (require 'mail-source)
+ (require 'message)
+ (require 'nnfolder)
+ (require 'sendmail)
+ #+END_SRC
+
+ I don't like having a lot of files spread around in my =.emacs.d=
+ directory, so put all of Gnus', Message's and nnfolder's data in
+ =.emacs.d/data=.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq gnus-directory (locate-user-emacs-file "data/News")
+ gnus-article-save-directory gnus-directory
+ gnus-cache-directory gnus-directory
+ gnus-kill-files-directory gnus-directory)
+
+ (setq mail-source-directory (locate-user-emacs-file "data/Mail")
+ message-directory mail-source-directory
+ nnfolder-directory mail-source-directory)
+ #+END_SRC
+
+ Use msmtp to send my messages.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq send-mail-function 'send-mail-send-it
+ message-send-mail-function 'message-send-mail-with-sendmail
+ sendmail-program "/usr/bin/msmtp")
+ #+END_SRC
+
+ I've been using Gnus for a while now and I don't think I fit the
+ profile of a novice anymore. Turning this off will stop Gnus from
+ asking me if I'm sure I want to delete a certain message, I do this
+ a lot because expiring messages seems to take too long for my
+ tastes.
+
+ #+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
+ (defun oni-gnus-delete-forward (&optional n)
+ "Delete the article under point and move to the next one.
+ Do this N times."
+ (interactive "p")
+ (dotimes (_ (or n 1))
+ (gnus-summary-delete-article)
+ (gnus-summary-next-subject 1)))
+
+ (define-key gnus-summary-mode-map (kbd "M-d") #'oni-gnus-delete-forward)
+ #+END_SRC
+
+ Change the format of how each line for a group in the Group buffer
+ is displayed. This shows the group name, the select method, group
+ subscription status, the process mark (whatever that is), whether
+ there is a summary buffer open for that group, number of unread
+ articles and the number of ticked articles.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq gnus-group-line-format "%P%(%20G%): %-10s %S%p%B %5y %5T\n")
+ #+END_SRC
+
+*** Mail accounts
+
+ I mostly use two email accounts.
+
+**** ryuslash.org
+
+ Set my main email account 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
+
+**** gmail.com
+
+ 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
+
** Org mode
:PROPERTIES:
:header-args: :tangle "init/oni-org-init.el"