]> git.siccegge.de Git - dotfiles/emacs.git/commitdiff
Import gnus config
authorChristoph Egger <christoph@christoph-egger.org>
Tue, 1 Mar 2016 20:02:08 +0000 (21:02 +0100)
committerChristoph Egger <christoph@christoph-egger.org>
Fri, 18 Mar 2016 13:44:41 +0000 (14:44 +0100)
gnus.el [new file with mode: 0644]
init.el

diff --git a/gnus.el b/gnus.el
new file mode 100644 (file)
index 0000000..89cb4a6
--- /dev/null
+++ b/gnus.el
@@ -0,0 +1,145 @@
+(require 'epa)
+;(require 'external-abook)
+;(setq external-abook-command "pc_query -m '%s' | cut -f 1,2")
+(require 'bbdb)
+(bbdb-initialize 'gnus)
+(require 'gnus)
+
+(eval-after-load "message"
+  '(progn
+     (add-to-list 'message-mode-hook
+                  '(lambda ()
+                     (define-key message-mode-map "\C-c\t" 'external-abook-try-expand)))))
+(require 'epa-file)
+(epa-file-enable)
+(setq epg-debug t)
+
+(setq mm-decrypt-option 'always)
+(setq mm-verify-option 'always)
+(setq mml-smime-use 'epg)
+
+(setq message-send-mail-function 'message-send-mail-with-sendmail)
+(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
+
+(gnus-demon-add-handler 'gnus-demon-scan-news 5 t)
+(gnus-demon-init)
+
+                                        ;(setq bbdb-ignore-some-messages-alist '(("To" . "admins@sieglitzhof.net")))
+
+(setq user-mail-address "christoph@christoph-egger.org"
+      user-full-name "Christoph Egger"
+      mm-verify-option 'known
+      mm-decrypt-option 'known
+      gnus-buttonized-mime-types '("multipart/signed" "multipart/encrypted")
+      gnus-select-method '(nntp "news.gmane.org")
+      mail-user-agent 'sendmail-user-agent)
+                                        ;      bbdb-send-mail-style 'message)
+
+(add-hook 'kill-emacs-hook (lambda () (let ((gnus-interactive-exit nil)) (gnus-group-exit))))
+
+(setq-default gnus-group-line-format "%P%M%S%m %4U/%-5y:%B%(%g%)\n"
+              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 "│")
+
+
+(setq gnus-secondary-select-methods '((nnimap "Main"
+                                              (nnimap-address "oteiza.siccegge.de")
+                                              (nnimap-authenticator login)
+                                              (nnimap-stream tls)
+                                              (nnimap-logout-timeout 5.0)
+                                              (nnimap-authinfo-file "/home/christoph/.imap-authinfo"))
+                                      ;; (nnimap "UCSB"
+                                      ;;          (nnimap-address "mail.engr.ucsb.edu")
+                                      ;;          (nnimap-authenticator plain)
+                                      ;;          (nnimap-stream tls))
+                                      (nntp "USENET"
+                                            (nntp-address "news.eternal-september.org")
+                                            (nntp-authenticator plain)
+                                            (nntp-stream ssl))))
+
+(setq gnus-posting-styles
+      '((".*"
+         (organization "Privat")
+         ("Gcc"  "nnimap+Main:SENT")
+         (address "christoph@christoph-egger.org"))
+        ("debian.*"
+         (orgainzation "The Debian Project")
+         (address "christoph@debian.org"))
+        ("sh.*"
+         (orgainzation "Studentenwohnheim Sieglitzhof Netzteam")
+         (address "christoph@sieglitzhof.net"))
+        ("uni.ucsb"
+         (address "siccegge@cs.fau.de"))
+        ("fsi.*"
+         (organization "Fachschaft Informatik, FAU Erlangen-Nürnberg")
+         (address "siccegge@cip.cs.fau.de")
+         ("reply-to" "fsi@cs.fau.de")
+         ("cc" "fsi@cs.fau.de")
+         (signature-file "~/.signature.fsi"))
+        ("fsi.kif.orga"
+         (organization "Fachschaft Informatik, FAU Erlangen-Nürnberg")
+         (address "siccegge@cip.cs.fau.de")
+         ("reply-to" "kif415-orga@fsi.cs.fau.de")
+         ("cc" "kif415-orga@fsi.cs.fau.de")
+         (signature-file "~/.signature.fsi"))))
+
+(mml-signencrypt-style "pgpmime" 'combined)
+
+(setq gnus-extra-headers '(To Cc Newsgroups Keywords List-Id Message-Id)
+      nnmail-extra-headers gnus-extra-headers)
+
+(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))
+    (message "Converting Atom to RSS... ")
+    (call-process-region (point-min) (point-max)
+                         "xsltproc"
+                         t t nil
+                         (expand-file-name "~/atom2rss.xsl") "-")
+    (goto-char (point-min))
+    (message "Converting Atom to RSS... done")))
+
+(ad-activate 'mm-url-insert)
+
+(defun my-crm114-learn ()
+  (interactive)
+  (unless (gnus-buffer-live-p gnus-article-buffer)
+    (error "No article buffer available"))
+  (save-excursion
+    (set-buffer gnus-article-buffer)
+    (save-restriction
+      (let ((commandsplit (split-string "ssh oteiza.siccegge.de /usr/share/crm114/mailreaver.crm -u /home/christoph/.crm114/"))
+            (outbuf (get-buffer-create "*crm114 output*"))
+            (spamflag (y-or-n-p "Is this spam? ")))
+        (gnus-summary-toggle-header 1)
+        (message-narrow-to-headers-or-head)
+        (unless (re-search-forward "^X-CRM114-CacheID:" nil t)
+          (error "No CRM144-CacheID header found"))
+        (nconc commandsplit
+               (if spamflag
+                   '("--spam")
+                 '("--good")))
+        (beginning-of-line)
+        (if (zerop (apply 'call-process-region
+                          (point) (progn (end-of-line) (point))
+                          (car commandsplit) nil outbuf
+                          nil (cdr commandsplit)))
+            (progn
+              (set-buffer outbuf)
+              (goto-char (point-max))
+              (re-search-backward "^X-CRM114-Action: \\(.*\\)" nil t)
+              (message (match-string 1))
+              (erase-buffer))
+          (error "Calling crm failed"))))))
+
+(define-key gnus-summary-mode-map
+  (kbd "C-M-s") 'my-crm114-learn)
+
+(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
diff --git a/init.el b/init.el
index 5cc2fcf54b27f584a84cb634ffec125915a81f59..074ffbfece7c3f66c903471710351c87d4a10fef 100644 (file)
--- a/init.el
+++ b/init.el
@@ -3,6 +3,7 @@
 (require 'cl)
 
 (setq emacs-private-config (expand-file-name "~/.emacs.d/config/"))
+(setq gnus-init-file (expand-file-name "~/.emacs.d/gnus.el"))
 
 (load-file "~/.emacs.d/emacs-site.el")