; -*- Emacs-Lisp -*-

;; no gnu head image
(setq gnus-mode-line-image-cache nil)

(setq gnus-startup-file (concat gnus-home-directory "newsrc"))

;; force "Eric Warmenhoven <$EMAIL>"
(setq mail-from-style 'angles)

;; Don't auto-save drafts
(setq message-auto-save-directory nil)

;; quoting
(setq message-citation-line-function 'message-insert-formatted-citation-line
      message-citation-line-format "On %c, %f wrote:")

;; If this is set, it will override gnus-select-method
(setq gnus-nntp-server nil)

;; I never want to know if there are new folders (I'll have created them myself)
(setq gnus-check-new-newsgroups nil)

;; No need to write ~/.newsrc, I don't use news
(setq gnus-save-newsrc-file nil)

;; No need to save killed groups, I don't kill mail
(setq gnus-save-killed-list nil)

;; A dribble file saves changes to .newsrc
(setq gnus-use-dribble-file nil)

;; where to save attachments to by default
(setq mm-default-directory "~/tmp/")

;; prefer anything over html
(setq mm-discouraged-alternatives '("text/html" "text/richtext"))

;; gnus-agent does caching, and makes it more likely that external
;; changes won't get picked up
(setq gnus-agent nil)

;; check for mail every minute
(gnus-demon-add-handler 'gnus-group-get-new-news 1 t)
(gnus-demon-init)

;; show message counts on modeline
;; TO ENABLE: in Group buffer, G p, then add (modeline-notify t) to list
(require 'gnus-notify)

;; mark Gcc articles as read
(setq gnus-gcc-mark-as-read t)

;; Fewer messages
(setq gnus-verbose 4)
(setq gnus-verbose-backends 5)

;; Use Gnus as my MUA
(setq mail-user-agent 'gnus-user-agent)

;; Don't send partial mails, always send it all in one shot
(setq message-send-mail-partially-limit nil)

;; Use smtpmail to send mail, rather than sendmail
(require 'smtpmail)
(setq send-mail-function 'smtpmail-send-it)
(setq message-send-mail-function 'smtpmail-send-it)

;; Signing/encrypting email
(require 'pgg)

;; Don't cache the gpg passphrase
(setq pgg-cache-passphrase nil)

;; Who am I?
(setq pgg-default-user-id "eric@warmenhoven.org")

;; don't use the full screen
(setq gnus-use-full-window nil)

(require 'mm-url)
(defadvice mm-url-insert (after DE-convert-atom-to-rss () )
  "Converts atom to RSS by calling xsltproc."
  (when (re-search-forward "xmlns=\"http://www.w3.org/.*/Atom\"" 
               nil t)
    (goto-char (point-min))
    (call-process-region (point-min) (point-max) 
             "xsltproc" 
             t t nil 
             (expand-file-name (concat gnus-home-directory "atom2rss.xsl")) "-")
    (goto-char (point-min))))

(ad-activate 'mm-url-insert)