]> git.siccegge.de Git - dotfiles/emacs.git/blob - gnus.el
Update irony-mode foo
[dotfiles/emacs.git] / gnus.el
1 (require 'epa)
2 ;(require 'external-abook)
3 ;(setq external-abook-command "pc_query -m '%s' | cut -f 1,2")
4 (require 'nnir)
5 (require 'bbdb)
6 (bbdb-initialize 'gnus)
7 (require 'gnus)
8
9 (eval-after-load "message"
10 '(progn
11 (add-to-list 'message-mode-hook
12 '(lambda ()
13 (define-key message-mode-map "\C-c\t" 'external-abook-try-expand)))))
14 (require 'epa-file)
15 (epa-file-enable)
16 (setq epg-debug t)
17
18 (setq mm-decrypt-option 'always)
19 (setq mm-verify-option 'always)
20 (setq mml-smime-use 'epg)
21
22 (setq message-send-mail-function 'message-send-mail-with-sendmail)
23 (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
24
25 (gnus-demon-add-handler 'gnus-demon-scan-news 5 t)
26 (gnus-demon-init)
27
28 ;(setq bbdb-ignore-some-messages-alist '(("To" . "admins@sieglitzhof.net")))
29
30 (setq user-mail-address "christoph@christoph-egger.org"
31 user-full-name "Christoph Egger"
32 mm-verify-option 'known
33 mm-decrypt-option 'known
34 gnus-buttonized-mime-types '("multipart/signed" "multipart/encrypted")
35 gnus-select-method '(nntp "news.gmane.org")
36 mail-user-agent 'sendmail-user-agent)
37 ; bbdb-send-mail-style 'message)
38
39 (add-hook 'kill-emacs-hook (lambda () (let ((gnus-interactive-exit nil)) (gnus-group-exit))))
40
41 (setq-default gnus-group-line-format "%P%M%S%m %4U/%-5y:%B%(%g%)\n"
42 gnus-sum-thread-tree-false-root ""
43 gnus-sum-thread-tree-indent " "
44 gnus-sum-thread-tree-leaf-with-other "├► "
45 gnus-sum-thread-tree-root ""
46 gnus-sum-thread-tree-single-leaf "╰► "
47 gnus-sum-thread-tree-vertical "│")
48
49
50 (setq gnus-secondary-select-methods '((nnimap "Main"
51 (nnimap-address "imap.siccegge.de")
52 (nnimap-authenticator login)
53 (nnimap-stream tls)
54 (nnimap-logout-timeout 5.0)
55 (nnir-search-engine imap)
56 (nnimap-authinfo-file "/home/christoph/.imap-authinfo"))
57 ;; (nnimap "UCSB"
58 ;; (nnimap-address "mail.engr.ucsb.edu")
59 ;; (nnimap-authenticator plain)
60 ;; (nnimap-stream tls))
61 (nntp "USENET"
62 (nntp-address "news.eternal-september.org")
63 (nntp-authenticator plain)
64 (nntp-stream ssl))))
65
66 (setq gnus-posting-styles
67 '((".*"
68 (organization "Privat")
69 ("Gcc" "nnimap+Main:SENT")
70 (address "christoph@christoph-egger.org"))
71 ("debian.*"
72 (organization "The Debian Project")
73 (address "christoph@debian.org"))
74 ("sh.*"
75 (organization "Studentenwohnheim Sieglitzhof Netzteam")
76 (address "christoph@sieglitzhof.net"))
77 ("uni.ucsb"
78 (address "siccegge@cs.fau.de"))
79 ("fsi.*"
80 (organization "Fachschaft Informatik, FAU Erlangen-Nürnberg")
81 (address "siccegge@cip.cs.fau.de")
82 ("reply-to" "fsi@cs.fau.de")
83 ("cc" "fsi@cs.fau.de")
84 (signature-file "~/.signature.fsi"))
85 ("fsi.kif.orga"
86 (organization "Fachschaft Informatik, FAU Erlangen-Nürnberg")
87 (address "siccegge@cip.cs.fau.de")
88 ("reply-to" "kif415-orga@fsi.cs.fau.de")
89 ("cc" "kif415-orga@fsi.cs.fau.de")
90 (signature-file "~/.signature.fsi"))))
91
92 (mml-signencrypt-style "pgpmime" 'combined)
93
94 (setq gnus-extra-headers '(To Cc Newsgroups Keywords List-Id Message-Id)
95 nnmail-extra-headers gnus-extra-headers)
96
97 (require 'mm-url)
98 (defadvice mm-url-insert (after DE-convert-atom-to-rss () )
99 "Converts atom to RSS by calling xsltproc."
100 (when (re-search-forward "xmlns=\"http://www.w3.org/.*/Atom\""
101 nil t)
102 (goto-char (point-min))
103 (message "Converting Atom to RSS... ")
104 (call-process-region (point-min) (point-max)
105 "xsltproc"
106 t t nil
107 (expand-file-name "~/atom2rss.xsl") "-")
108 (goto-char (point-min))
109 (message "Converting Atom to RSS... done")))
110
111 (ad-activate 'mm-url-insert)
112
113 (defun my-crm114-learn ()
114 (interactive)
115 (unless (gnus-buffer-live-p gnus-article-buffer)
116 (error "No article buffer available"))
117 (save-excursion
118 (set-buffer gnus-article-buffer)
119 (save-restriction
120 (let ((commandsplit (split-string "ssh oteiza.siccegge.de /usr/share/crm114/mailreaver.crm -u /home/christoph/.crm114/"))
121 (outbuf (get-buffer-create "*crm114 output*"))
122 (spamflag (y-or-n-p "Is this spam? ")))
123 (gnus-summary-toggle-header 1)
124 (message-narrow-to-headers-or-head)
125 (unless (re-search-forward "^X-CRM114-CacheID:" nil t)
126 (error "No CRM144-CacheID header found"))
127 (nconc commandsplit
128 (if spamflag
129 '("--spam")
130 '("--good")))
131 (beginning-of-line)
132 (if (zerop (apply 'call-process-region
133 (point) (progn (end-of-line) (point))
134 (car commandsplit) nil outbuf
135 nil (cdr commandsplit)))
136 (progn
137 (set-buffer outbuf)
138 (goto-char (point-max))
139 (re-search-backward "^X-CRM114-Action: \\(.*\\)" nil t)
140 (message (match-string 1))
141 (erase-buffer))
142 (error "Calling crm failed"))))))
143
144 (define-key gnus-summary-mode-map
145 (kbd "C-M-s") 'my-crm114-learn)
146
147 (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)