Skip to content

Instantly share code, notes, and snippets.

@rothmichaels
Last active July 29, 2016 22:14
Show Gist options
  • Select an option

  • Save rothmichaels/813b03cd4ff153e41121bb29382fc8bc to your computer and use it in GitHub Desktop.

Select an option

Save rothmichaels/813b03cd4ff153e41121bb29382fc8bc to your computer and use it in GitHub Desktop.
Gnus Configuration
(setq user-full-name "Roth Michaels"
user-mail-address "roth@rothmichaels.us")
(setq my-email-addresses '("roth@rothmichaels.us"
"roth@wasabihut.com"
"roth@myble.net"
"roth@sohoko.io"))
(setq message-alternative-emails (regexp-opt my-email-addresses))
(setq gnus-from-selected-index 0)
(defun gnus-loop-from ()
(interactive)
(setq gnus-article-current-point (point))
(goto-char (point-min))
(if (eq gnus-from-selected-index (length my-email-addresses))
(setq gnus-from-selected-index 0) nil)
(let ((current-email-address (nth gnus-from-selected-index
my-email-addresses)))
(while (re-search-forward "^From:.*$" nil t)
(replace-match (concat
"From: " user-full-name
" <" current-email-address ">")))
(goto-char (point-min))
(while (re-search-forward "^User-Mail-Address:.*$" nil t)
(replace-match (concat
"User-Mail-Address: " current-email-address))))
(goto-char gnus-article-current-point)
(setq gnus-from-selected-index (+ gnus-from-selected-index 1)))
(define-key message-mode-map (kbd "C-c f") 'gnus-loop-from)
(setq gnus-select-method '(nntp "news.gmane.org"))
(setq gnus-secondary-select-methods
'((nnimap "roth"
(nnimap-address "imap.gmail.com")
(nnimap-server-port 993)
(nnimap-stream ssl)
(nnimap-authinfo-file "~/.authinfo.gpg"))
(nnimap "wasabi"
(nnimap-address "imap.gmail.com")
(nnimap-server-port 993)
(nnimap-stream ssl)
(nnimap-authinfo-file "~/.authinfo.gpg"))
(nnimap "myble"
(nnimap-address "imap.gmail.com")
(nnimap-server-port 993)
(nnimap-stream ssl)
(nnimap-authinfo-file "~/.authinfo.gpg"))))
(setq gnus-parameters
'(("roth"
(display . all)
(posting-style
(name "Roth Michaels")
(address "roth@rothmichaels.us")
(user-mail-address "roth@rothmichaels.us")
(signature-file "~/.signature-roth"))
(expiry-target . delete)
(expiry-wait . immediate))
("wasabi"
(display . all)
(posting-style
(name "Roth Michaels")
(address "roth@wasabihut.com")
(user-mail-address "roth@wasabihut.com")
(organization "Wasabi Hut, Inc.")
(signature-file "~/.signature-wasabi"))
(expiry-target . delete)
(expiry-wait . immediate))
("myble"
(display . all)
(posting-style
(name "Roth Michaels")
(address "roth@sohoko.io")
(user-mail-address "roth@sohoko.io")
(organization "MyBLE, Inc.")
(signature-file "~/.signature-myble"))
(expiry-target . delete)
(expiry-wait . immediate))))
;; http://www.cataclysmicmutation.com/2010/11/multiple-gmail-accounts-in-gnus
(setq message-send-mail-function 'message-send-mail-with-sendmail)
;(defalias 'message-send-mail-function 'message-send-mail-with-sendmail)
(setq sendmail-program "/opt/local/bin/msmtp")
(setq message-sendmail-envelope-from 'header)
;; https://www.emacswiki.org/emacs/GnusMSMTP
;; This is needed to allow msmtp to do its magic:
;(setq message-sendmail-f-is-evil 't)
;;need to tell msmtp which account we're using
;(setq message-sendmail-extra-arguments '("--read-envelope-from"))
;; ????where is this from?
(setq gnus-permanently-visible-groups ".*")
;; https://www.emacswiki.org/emacs/GnusGmail
(setq gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")
;(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;; https://github.com/redguardtoo/mastering-emacs-in-one-year-guide/blob/master/gnus-guide-en.org
(setq gnus-thread-sort-functions
'((not gnus-thread-sort-by-date)
(not gnus-thread-sort-by-number)))
; NO 'passive
(setq gnus-use-cache t)
;; open attachment
;; (eval-after-load 'mailcap
;; '(progn
;; (cond
;; ;; on OSX, maybe change mailcap-mime-data?
;; ((eq system-type 'darwin))
;; ;; on Windows, maybe change mailcap-mime-data?
;; ((eq system-type 'windows-nt))
;; (t
;; ;; Linux, read ~/.mailcap
;; (mailcap-parse-mailcaps)))));; Tree view for groups. I like the organisational feel this has.
;; from old .gnus.el
(setq-default
gnus-summary-line-format "%U%R%z %(%&user-date; %-15,15f %B%s%)\n"
gnus-user-date-format-alist '((t . "%Y-%m-%d %H:%M"))
gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references
gnus-sum-thread-tree-false-root ""
gnus-sum-thread-tree-indent ""
gnus-sum-thread-tree-leaf-with-other "-> "
gnus-sum-thread-tree-root ""
gnus-sum-thread-tree-single-leaf "|_ "
gnus-sum-thread-tree-vertical "|")
;; (add-hook 'message-mode-hook
;; '(lambda ()
;; (flyspell-mode t)
;; (local-set-key "<TAB>" 'bbdb-complete-name)))
;; Fetch only part of the article if we can. I saw this in someone
;; else's .gnus
(setq gnus-read-active-file 'some)
;; Tree view for groups. I like the organisational feel this has.
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;; Threads! I hate reading un-threaded email -- especially mailing
;; lists. This helps a ton!
(setq gnus-summary-thread-gathering-function
'gnus-gather-threads-by-subject)
;; Also, I prefer to see only the top level message. If a message has
;; several replies or is part of a thread, only show the first
;; message. 'gnus-thread-ignore-subject' will ignore the subject and
;; look at 'In-Reply-To:' and 'References:' headers.
(setq gnus-thread-hide-subtree nil)
(setq gnus-thread-ignore-subject t)
;; citations
(setq message-citation-line-function 'message-insert-formatted-citation-line)
(setq message-citation-line-format "On %a, %b %d %Y at %r, %f wrote:")
;http://www.gnu.org/software/emacs/manual/html_node/gnus/_005b9_002e2_005d.html
(setq gnus-use-correct-string-widths nil)
;(gnus-compile)
;; newer
;; (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;; ;; Threads! I hate reading un-threaded email -- especially mailing
;; ;; lists. This helps a ton!
;; (setq gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject)
;; ;; Also, I prefer to see only the top level message. If a message has
;; ;; several replies or is part of a thread, only show the first
;; ;; messa 'gnus-thread-ignore-subject' will ignore the subject and
;; ;; look at 'In-Reply-To:' and 'References:' headers.
;; (setq gnus-thread-hide-subtree t)
;; (setq gnus-thread-ignore-subject t)
;; ;; http://www.gnu.org/software/emacs/manual/html_node/gnus/_005b9_002e2_005d.html
;; (setq gnus-use-correct-string-widths nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment