Skip to content

Instantly share code, notes, and snippets.

@jmibanez
Created June 25, 2018 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmibanez/f95b5e6c28442ebded30ff792f38f534 to your computer and use it in GitHub Desktop.
Save jmibanez/f95b5e6c28442ebded30ff792f38f534 to your computer and use it in GitHub Desktop.
(setq user-mail-address "jm@jmibanez.com"
user-full-name "JM Ibañez"
gnus-default-charset 'utf-8
mail-user-agent 'gnus-user-agent)
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
(defun jmi/gnus-mailto-list-to-regex (my-addresses)
(mapconcat (lambda (addr)
(concat "\\(" addr "\\)"))
my-addresses "\\|"))
(setq gnus-ignored-from-addresses
(jmi/gnus-mailto-list-to-regex
'("jm@jmibanez.com"
"jmibanez@gmail.com")))
(setq gnus-summary-line-format "%d %U%R%z%(%[%4L: %-20,20f% %]%)%B %s\n"
gnus-sum-thread-tree-root "="
gnus-sum-thread-tree-false-root "< "
gnus-sum-thread-tree-single-indent " "
gnus-sum-thread-tree-indent " "
gnus-sum-thread-tree-leaf-with-other "+-> "
gnus-sum-thread-tree-single-leaf "`-> "
gnus-sum-thread-tree-vertical "| "
gnus-fetch-old-headers nil
gnus-use-adaptive-scoring '(line)
gnus-article-banner-alist '(("@yahoogroups\\.com"
. "^\\(_+\nDo You Yahoo\\|.*Yahoo\! Groups Links\\|.*Yahoo\! Groups Sponsor\\)\\(.*\n\\)+"))
mm-attachment-override-types '("image/.*"))
;; Splitting
(setq nnmail-crosspost t
nnmail-split-methods 'nnmail-split-fancy
nnmail-split-fancy
`(|
(any "\\b\\(\\w+\\)-owner@googlegroups.com" "mail.misc")
(any "\\(\\w+\\)-noreply@.*" "mail.misc")
(any "noreply@.*" "mail.misc")
(any "noreply-\\(.+\\)@.*" "mail.misc")
(any "\\(\\w+\\)-no-reply@.*" "mail.misc")
(any "no-reply@.*" "mail.misc")
("List-Id" ".*<\\(.+\\).yahoogroups.com>.*" "lists.\\1")
("List-Id" ".*<\\(.+\\).googlegroups.com>.*" "lists.\\1")
;; Meetup.com lists
("List-Id" ".*<\\(.+\\)-list.meetup.com>.*" "lists.meetup.\\1")
;; For all Yahoo! Groups
;; ("List-Id" "\\b\\(\\w+\\)-\\b\\(\\w+\\)@yahoogroups.com" "lists.\\1-\\2")
;; ("List-Id" "\\b\\(\\w+\\)_\\b\\(\\w+\\)@yahoogroups.com" "lists.\\1-\\2")
;; ("List-Id" "\\b\\(\\w+\\)@yahoogroups.com" "lists.\\1")
;; Rules to hit the various google groups. We're having
;; problems with dashes, so we have to expand these
;; ("List-Id" "\\b\\(\\w+\\)-\\b\\(\\w+\\)-\\b\\(\\w+\\)-\\b\\(\\w+\\)@googlegroups.com" "lists.\\1-\\2-\\3-\\4")
;; ("List-Id" "\\b\\(\\w+\\)-\\b\\(\\w+\\)-\\b\\(\\w+\\)@googlegroups.com" "lists.\\1-\\2-\\3")
;; ("List-Id" "\\b\\(\\w+\\)-\\b\\(\\w+\\)@googlegroups.com" "lists.\\1-\\2")
;; ("List-Id" "\\b\\(\\w+\\)@googlegroups.com" "lists.\\1")
;; free.net.ph lists
(to "\\b\\(\\w+\\)-\\b\\(\\w+\\)@lists.free.net.ph" "lists.\\1-\\2")
(to "\\b\\(\\w+\\)@lists.free.net.ph" "lists.\\1")
(to "\\b\\(\\w+\\)-\\b\\(\\w+\\)@lists.linux.org.ph" "lists.\\1-\\2")
(to "\\b\\(\\w+\\)@lists.linux.org.ph" "lists.\\1")
("List-Id" ".*<\\(.+\\).lists.free.net.ph>.*" "lists.\\1")
("List-Id" ".*<\\(.+\\).lists.linux.org.ph>.*" "lists.\\1")
;; Rules for freedesktop.org lists
("List-Id" "\\b\\(\\w+\\)-\\b\\(\\w+\\).lists.freedesktop.org" "lists.freedesktop.\\1-\\2")
("List-Id" "\\b\\(\\w+\\).\\b\\(\\w+\\).lists.freedesktop.org" "lists.freedesktop.\\1.\\2")
("List-Id" "\\b\\(\\w+\\).lists.freedesktop.org" "lists.freedesktop.\\1")
(to "\\b\\(\\w+\\)-\\b\\(\\w+\\)@lists.freedesktop.org" "lists.freedesktop.\\1.\\2")
(to "\\b\\(\\w+\\)@lists.freedesktop.org" "lists.freedesktop.\\1")
;; Rules for SVN users mailing list
(any "users@subversion.tigris.org" "lists.subversion-users")
;; DevconPH emails
(any "@devcon.ph" "lists.devcon-ph")
;; Mailchimp and other marketing stuff -- dump to misc
(any "@mailchimp.com" "mail.misc")
(any "@macphun.com" "mail.misc")
(any "@getharvest.com" "mail.misc")
(any "@harvestapp.com" "mail.misc")
(any "@uber.com" "mail.misc")
(any "@imazing.com" "mail.misc")
(any "@slack-core.com" "mail.misc")
(any "@sofitel.com" "mail.misc")
(any "@mailer.humblebundle.com" "mail.misc")
;; ArsTechnica notifications (List-Id special-case)
("List-Id" "af7f013bad7e785d15aab736f.95432.list-id.mcsv.net" "mail.misc.arstechnica")
;; Slack notifications
(any ".*<\\(.+\\)>.*@slack.com" "notifications.\\1")
;; Github PRs
("List-Id" ".*<\\(\\w+\\)\\.\\(\\w+\\).github.com>.*" "github-pr.\\2.\\1")
;; Catch-all for lists
("List-Id" ".*<\\(.+\\)>.*" "lists.\\1")
;; Before hitting my personal mailbox, filter out Facebook
;; stuff into misc
(any "\\w+@facebookmail.com" "mail.misc")
(any "\\w+@facebook.com" "mail.misc")
;; Misc: Replies to my mail
(any ,gnus-ignored-from-addresses "mail.personal")
;; We have to move all "parent-of" to the proper place, if
;; we don't match any of the above rules
(: nnmail-split-fancy-with-parent)
;; Default: Hit the misc
"mail.misc"))
(defun jmi/gmail-nnimap-entry (key)
(let ((auth-key (format "gnus-%s" key)))
`(nnimap ,auth-key
(nnimap-inbox "INBOX")
(nnimap-address "imap.gmail.com")
(nnimap-stream ssl)
(nnimap-server-port "imaps")
(nnimap-expunge-on-close ask)
(nnimap-split-crosspost t)
(nnimap-split-methods nnmail-split-fancy)
(nnimap-split-fancy ,nnmail-split-fancy))))
(defun jmi/maildir-entry (key)
(let ((maildir-dir (format "~/Mail/%s" key)))
`(nnmaildir ,key
(directory ,maildir-dir)
(directory-files nnheader-directory-files-safe)
(get-new-mail t)
(nnmail-split-methods nnmail-split-fancy)
(nnmail-split-fancy ,nnmail-split-fancy))))
(setq gnus-select-method
'(nnml "")
gnus-secondary-select-methods
(list (jmi/gmail-nnimap-entry "jmibanez.com")
(jmi/gmail-nnimap-entry "gmail"))
;; '((nnmaildir "gmail"
;; (directory "~/Mail/gmail")
;; (directory-files nnheader-directory-files-safe)
;; (get-new-mail t))
;; (nnmaildir "jmibanez.com"
;; (directory "~/Mail/jmibanez.com")
;; (directory-files nnheader-directory-files-safe)
;; (get-new-mail t))
)
(setq smtpmail-smtp-server "smtp.gmail.com"
smtpmail-smtp-service 587
smtpmail-auth-credentials '(("smtp.gmail.com" 587 "jm@jmibanez.com"))
gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment