Skip to content

Instantly share code, notes, and snippets.

@bradclawsie
Created December 5, 2010 04:09
Show Gist options
  • Save bradclawsie/728771 to your computer and use it in GitHub Desktop.
Save bradclawsie/728771 to your computer and use it in GitHub Desktop.
public .gnus.el
(require 'smtpmail)
(require 'pgg)
;; -------------------------------------------------------------
;; location awareness
(if (run-at-home)
(setq user-mail-address "REDACTED")
(setq user-mail-address "REDACTED"))
;; -------------------------------------------------------------
;; global settings
(setq user-full-name "REDACTED")
(setq-default gnus-asynchronous t)
(setq-default gnus-novice-user nil)
(setq-default gnus-use-cache t)
(setq-default message-mode-hook (quote (mail-text
turn-on-auto-fill turn-on-font-lock mail-text not-modified)))
(setq-default mm-inline-text-html-with-w3m-keymap t)
(setq-default mm-text-html-renderer (quote w3m))
(setq gnus-secondary-select-methods nil)
(setq gnus-summary-make-false-root 'dummy)
(setq display '[and (not killed) (not dormant) (not expire)])
(setq gnus-suppress-duplicates t)
(setq gnus-summary-ignore-duplicates t)
(setq nnmail-treat-duplicates 'delete)
(setq mm-discouraged-alternatives
(append mm-discouraged-alternatives
'("text/html" "text/richtext")))
;; no newsrc
(setq
gnus-save-newsrc-file nil
gnus-read-newsrc-file nil
)
;; check email
(gnus-demon-add-handler 'gnus-group-get-new-news 1 t)
(gnus-demon-init)
;; pgg
(setq mm-verify-option 'known)
(setq mm-decrypt-option 'known)
;; saving sent messages
(setq gnus-message-archive-group
'((if (message-news-p)
"nnml:Send-News"
"nnml:Send-Mail")))
(setq gnus-visible-headers
'("^From" "^Subject" "^Date" "^To" "^Cc" "^User-Agent"))
;; -------------------------------------------------------------
;; mail macros and shortcuts
(fset 'gotogroup
[?\C-x ?b ?* ?G ?r ?o ?u ?p ?* return])
(global-set-key (kbd "C-c m") 'gotogroup)
(fset 'purgemail
[?\C-c ?s ?B backspace ?q ?g])
(global-set-key (kbd "C-c p") 'purgemail)
(global-set-key (kbd "C-c i") 'fmbiff)
(global-set-key (kbd "C-c s") 'gnus-uu-mark-all)
;; -------------------------------------------------------------
;; connect to imaps
;; dovecot
(if (not t) ;; may put some condition in later when can't use local dovecot
(setq gnus-select-method
'(nnimap "Mail"
(nnimap-address "REDACTED")
(nnimap-user "REDACTED")
(nnimap-stream ssl)
(nnimap-expunge-on-close always)
(nnimap-server-port 993)))
(setq gnus-select-method
'(nnimap "Mail"
(nnimap-address "localhost")
(nnimap-user "REDACTED")
(nnimap-stream ssl)
(nnimap-expunge-on-close always)
(nnimap-server-port 993))))
;; -------------------------------------------------------------
;; sending mail
(setq send-mail-function 'smtpmail-send-it)
(setq message-send-mail-function 'smtpmail-send-it)
(setq smtpmail-starttls-credentials
'(("REDACTED" 25 nil nil)))
(setq smtpmail-smtp-server "REDACTED")
(setq smtpmail-default-smtp-server "REDACTED")
;; -------------------------------------------------------------
;; identity management
(setq gnus-posting-styles
'(((header "to" "REDACTED")
(from (concat user-full-name " REDACTED"))
(setq message-cite-reply-above nil))
((header "to" "REDACTED")
(from (concat user-full-name " REDACTED"))
(setq message-cite-reply-above nil))
((header "to" "REDACTED")
(from (concat user-full-name " REDACTED"))
(setq message-cite-reply-above 't))
((header "to" "REDACTED")
(from (concat user-full-name " REDACTED"))
(setq message-cite-reply-above nil))))
;; (setq nnmail-expiry-wait `immediate)
;; -------------------------------------------------------------
;; biff
(defvar foundnewmbox "")
(defun fmbiff ()
(interactive)
(save-excursion
(set-buffer "*Group*")
(beginning-of-buffer)
(defvar foundanymbox nil)
(cond ((re-search-forward "INBOX.in" nil t)
(setq foundanymbox t))
(t (setq foundanymbox nil)))
(set-buffer "*Group*")
(beginning-of-buffer)
(cond ((re-search-forward "0: INBOX.in" nil t)
(setq foundnewmbox ""))
(t (if foundanymbox (setq foundnewmbox "[M]")
(setq foundnewmbox ""))))))
(unless (member 'foundnewmbox global-mode-string)
(setq global-mode-string (append global-mode-string
(list 'foundnewmbox))))
(add-hook 'gnus-after-getting-new-news-hook 'fmbiff)
(add-hook 'gnus-group-mode-hook 'fmbiff)
;; -------------------------------------------------------------
;; system overrides
(defcustom pgg-gpg-program "gpg2"
"The GnuPG executable."
:group 'pgg-gpg
:type 'string)
;; override default attachment viewers - requires ~/.mailcap entry
(add-to-list 'mm-inline-media-tests
'("application/pdf" mm-inline-text identity))
(add-to-list 'mm-attachment-override-types "application/pdf")
;;(add-to-list 'mm-automatic-display "application/pdf")
;;(add-to-list 'mm-automatic-external-display "application/pdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment