费了好大力气,参考了很多网上大牛们的配置才将EMACS+GNUS配置的比较可以了,包括可以自己设定MAIL中的头像标志,在这里把配置重点写一下。
我用的是EMACS22,回头再把emacs的.emacs配置文件发出来,这里只说.gnus.el的配置。
;;Gnus 是个古老的,强大的邮件,新闻阅读lisp程序.
;;用户资料设定
(setq user-full-name "Binglin Young")
(setq user-mail-address "Swordgreen@gmail.com")
(setq message-signature-file "~/.signature") ;;签名文件
;;服务器的设定
(setq gnus-select-method '(nntp "news.newsfan.net"))
(add-to-list 'gnus-secondary-select-methods '(nntp "news.newsfront.net"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "news.php.net"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "news.newsgroup.com.hk"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "news.CN99.com"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "groups.google.com"))
;;开启代理功能,为了能让gnus支持离线浏览,gnus 5.10.x会自动开启该功能。
;(gnus-agentize)
;;自动换行功能。
(add-hook 'message-mode-hook
(lambda ()
(setq fill-column 80) ;;这里的72是等一行到了72个字符后开始换行
(turn-on-auto-fill)))
(setq message-cite-function 'message-cite-original-without-signature)
;; 设定帖子的字符集
;(setq gnus-summary-show-article-charset-alist '((1 . cn-gb-2312) (2 . big5)))
(setq gnus-default-charset 'cn-gb-2312) ;; 默认编码
(setq gnus-group-name-charset-group-alist '((".*" . cn-gb-2312))) ;; 组名编码
(setq gnus-summary-show-article-charset-alist '((1 . cn-gb-2312) (2 . big5))) ;; 刷新编码
(setq gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown iso-8859-1)) ;; 忽略编码
;;设置发出邮件的编码
(setq gnus-posting-styles
'((".*"
(name "Binglin Young")
("Face" "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAACXBIWXMAAAsSAAALEgHS3X78AAAA
CXZwQWcAAAAwAAAAMADO7oxXAAAQnUlEQVRYw2V5y5JkR3Ldcfd43JuZ9epqNIBBA0OQ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BbOSUBI
y3Gx1oEYqo4QYVJH+HEM9rDRa0mztWqrc9gYOSjMT6fT2jYSUdWuo0y1NyUikZxSYiEAkgtNpXXv
ARgkXc4JLBBIaqOnVj7+9NPn5yfwMHiqCeRpbC0MlC4fAkrEweEawXJe13Y+EzTXNB+mOk+JaXs5
ZeLzunTVaZosfJiCKVgkpTrNtdbLXVDNY6iBjIUoiEVAxEgy5ZzFZdnWzz///Jtvv6ZojmARN/2/
KR6ihQE+ieAAAAAielRYdGNvbW1lbnQAAHjacy5KTSxJTVEozyzJUHD39A0AADedBeLMEcW+AAAA
GnpUWHRqcGVnOmNvbG9yc3BhY2UAAHjaMwIAADMAM4k4IzUAAAApelRYdGpwZWc6c2FtcGxpbmct
ZmFjdG9yAAB42jOqMNIxrDDUMawwBAARgwLpc6/3QwAAAABJRU5ErkJggg==") ;;这一段就是你的头像标志了,后面将加以说明
(address "SwordGreen@Gmail.com")
(organization "Moldova State University")
(eval (setq mm-coding-system-priorities
'(iso-8859-1 gb2312 utf-8))))
("^tw.comp"
(name "Binglin Young")
(address "SwordGreen@Gmail.com")
(organization "Moldova State University")
(eval (setq mm-coding-system-priorities
'(iso-8859-1 big5 utf-8)))))
)
;; 改变阅读新闻时窗口的布局,窗口划分为上4下6(比例)
(gnus-add-configuration '(article
(vertical 1.0
(summary .3 point)
(article 1.0))))
;;;
(setq gnus-confirm-mail-reply-to-news t
message-kill-buffer-on-exit t
message-elide-ellipsis "[...]n"
)
;;排序
(setq gnus-thread-sort-functions
'(
(not gnus-thread-sort-by-date)
(not gnus-thread-sort-by-number)
))
;; 新闻组分组
;; 有时订阅了很多新闻组,堆在一起不好管理。这个功能可以创建目录来分层管理
;; 这些新闻组。
;; group topic
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;; 现在可以在group buffer里面M-x gnus-topic-create-topic来创建一个"topic",
;; 然后将某个新闻组或者其他topic给C-k掉,再移动到你创建的topic下C-y,就可以
;; 将它们收到这个topic下。
;; topic的好处除了分层之外,还有就是可以将不常看的topic折叠起来,不要显示。
;; 就像下面这样。
;;
;; [ Gnus -- 0 ]
;; [ MAIL -- 3 ]...
;; [ NEWS -- 0 ]
;; [ emacs -- 0 ]
;; *: nntp+binghe.6600.org: gnu.emacs.help
;; *: nntp+binghe.6600.org:gnu.emacs.gnus
;; [ 人文与社会 -- 0 ]
;; [ 语言 -- 0 ]
;; *: nntp+news.newsfan.net:教育就业.外语.日语
;; *: nntp+news.newsfan.net: 教育就业.外语.英语
;; [ misc -- 0 ]...
;;
;; 参考 gnus info -> Group Buffer -> Group Topics
;;中文设置
(setq gnus-summary-show-article-charset-alist
'((1 . cn-gb-2312) (2 . big5) (3 . gbk) (4 . utf-8)))
(setq
gnus-default-charset 'cn-gb-2312
gnus-group-name-charset-group-alist '((".*" . cn-gb-2312))
gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown iso-8859-1 ISO-8859-15 x-gbk GB18030 gbk DEFAULT_CHARSET))
;;;;;;;;;;;;;;;;;;;;
;;解决gb18030乱码
;;;;;;;;;;;;;;;;;;;;
(setq gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown gb18030))
;另外,有些用web方式发出的邮件里有html,加入下面的设置,只看其中的
;plain text部分:
(eval-after-load "mm-decode"
'(progn
(add-to-list 'mm-discouraged-alternatives "text/html")
(add-to-list 'mm-discouraged-alternatives "text/richtext")))
;; Use emacs-w3m to render html mails and display images
(setq mm-text-html-renderer 'w3m
mm-inline-text-html-with-images t
mm-inline-large-images t)
;; Show plain text part by default, but provide buttons for the
;; html part
(setq mm-discouraged-alternatives '("text/html" "text/richtext" "text/enriched")
gnus-buttonized-mime-types '("multipart/signed" "multipart/alternative"))
;;;;;;;;;;;;;;;;;;;;
;;自动显示图片
;;;;;;;;;;;;;;;;;;;;
(auto-image-file-mode)
(setq mm-inline-large-images t)
(add-to-list 'mm-attachment-override-types "image/*")
;;当你按下发送邮件的组合键时,gnus就会要求你确认,
;;当你回答“yes”时才会发送邮件,如果回答“no”将取消发送。
(defadvice message-send (around my-confirm-message-send)
(if (yes-or-no-p "Really send message? ")
ad-do-it))
(ad-activate 'message-send)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq message-cite-function 'message-cite-original-without-signature)
;;获取整个回话
;(setq gnus-fetch-old-headers 'some) ;开启后,每次从服务器下载量太大
;;将头信息完整的表示出来
(setq gnus-visible-headers
"^(From:|Subject:|Date:|Followup-To:|X-Newsreader:|User-Agent:|X-Mailer:)")
;;美化帖子排布
(setq gnus-summary-line-format ":%U%R %B %s %-60=|%4L |%-20,20f |%&user-date; n")
;;加快进组速度
(gnus-compile)
;; Set this to t if you've got a slow connection
(setq gnus-asynchronous nil)
;; Turn on nntp and imap cache
(setq gnus-cacheable-groups "^(nntp)")
;;开启缓存来保存文章
(setq gnus-use-cache t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; 开启记分功能
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq gnus-use-adaptive-scoring t)
(setq gnus-save-score t)
(add-hook 'mail-citation-hook 'sc-cite-original)
(add-hook 'message-sent-hook 'gnus-score-followup-article)
(add-hook 'message-sent-hook 'gnus-score-followup-thread)
;;自动刷新,查看是否有新文章
;; Automate the fetching of mail.
(require 'gnus-demon)
;; Check for new mail once in every this many minutes.
(gnus-demon-add-handler 'gnus-demon-scan-news 5 nil)
;; Add some custom keys, press f5 to refresh the group at the cursors or press M-f5 to refresh all groups at level 1 or lower
;; (remember to set the group level to 1 to be refreshed by this)
(define-key gnus-group-mode-map [f5] 'gnus-group-get-new-news-this-group)
(define-key gnus-group-mode-map [(meta f5)] '(lambda ()
(interactive)
(gnus-group-get-new-news 1)))
对头像图表制作的说明(注意,我这里使用的是Face, 而不是X-Face,这两者之间的文件格式或着说是face header并不一样,网上比较容易找到X-Face的资料,但Face的很少,可是不知道为什么,我的emacs就是不支持X-Face, 但可以使用Face header)。
首先你需要制作一个48*48像素的png图像文件,然后去
http://www.motobit.com/util/base64-decoder-encoder.asp
生成你需要的face header. 再在你的.gnus.el文件中加入这段header代码,具体的地方就是那个像乱码一样的一段代码。
然后重新启动gnus,去新闻组发个帖子看看,你的头像是不是已经在邮件头信息里了。
以下是效果图,现在写起来容易,为了配置好,可是把我累了个半死,走了不少弯路啊。
回头再写写如何使用gnus浏览新闻组吧(今天实在是太累了,回头补上)。