NoteBook1

来自公开记录
跳到导航 跳到搜索

笔记本 1

实验用的 QQ 号

2426552485

E2-430 的密码

614386 不知道还是否有效。

VIM 全局替换

:%s/<original>/<destination>/g


Zhan 的 Gnus 配置文件

很久之前 Ubuntu 中文社区的 Zhan 通过 IRC 给我的他的 Gnus 配置文件,在当初对我帮助很大。文件我保存了很久,主要为了留念,虽然我早就把自己的配置文件改的跟这个差很多了。 --- FengLiu 2012/01/24 12:11

#!highlight common-lisp
;;============================================================
;;======================gnus 的配置============================
;;============================================================
;;Time-stamp: <zhan 2007-11-06 13:40:44>

(setq user-full-name "Zhan")                  ; 名字 
(setq user-mail-address "ustczhan@gmail.com") ; 邮箱地址 
(add-hook 'mail-mode-hook 'mail-abbrevs-setup)

;; 设定nntp服务器,现在国内很全的就是这两个了 cn99 和 yaako 找一个就可以了 
(setq gnus-select-method '(nntp "news.yaako.com"))
(setq gnus-secondary-select-methods 
      '((nnimap "gmail"
                ;; (nnimap-authenticator login)
		(nnimap-address "imap.gmail.com")
		;; (nnimap-server-port 993)
		(nnimap-stream ssl)
		(nnimap-list-pattern ("INBOX.*"))
		(nnimap-authinfo-file "~/.emacs.d/.imap-gmail"))
		;; (nnimap-expunge-on-close "ask")
        (nnimap "other"
		(nnimap-address "otherimapserver")
		;; (nnimap-server-port 143)
		(nnimap-list-pattern ("INBOX"))
		;; (nnimap-authenticator login)
		(nnimap-stream network)
		(nnimap-authinfo-file "~/.emacs.d/.imap-other")
		)))
      
(gnus-agentize)
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode) 
(setq gnus-summary-show-article-charset-alist 
      '((1 . cn-gb-2312) (2 . big5) (3 . gbk) (4 . utf-8))) 

;; (eval-after-load "mm-decode" 
;;    '(progn 
;;     (add-to-list 'mm-discouraged-alternatives "text/html") 
;;     (add-to-list 'mm-discouraged-alternatives "text/richtext")))

(setq mm-discouraged-alternatives
      '("text/html" "text/richtext" "text/enriched")
      gnus-buttonized-mime-types
      '("multipart/signed" "multipart/alternative"))

(setq mm-text-html-renderer 'w3m) 
(setq mm-inline-text-html-with-images t)
(setq mm-inline-text-html-with-w3m-keymap nil) 

(eval-after-load "gnus-sum" 
  '(add-to-list 
    'gnus-newsgroup-variables 
    '(mm-discouraged-alternatives 
      . '("text/html" "image/.*")))) 

;; (setq nnrss-wash-html-in-text-plain-parts t)

(setq gnus-show-mime nil        ; 有些中文的mime文章用iso8859-1 #@@!$%
      gnus-read-active-file 'some	; 加快gnus起动.
      gnus-use-cross-reference t
      gnus-check-new-newsgroups 'ask-server ; 加快gnus起动
      gnus-summary-line-format "%U%R%z%I%2t:%B %(%-60,60s%)  |%-14n\n"
      gnus-thread-hide-subtree t	; 同一个thread只要show一行
      ;; gnus-button-url 'gnus-netscape-open-url  ; 用netscape intead of w3-mode
      gnus-activate-foreign-newsgroups nil ; gnus 可以同时读好几个news server
      gnus-cited-closed-text-button-line-format
      "\[ Skip %n lines (%l Characters) \]\n"
      gnus-article-strip-blank-lines t
      gnus-article-skip-boring t
      ;; gnus-interactive-catchup nil  ; catch up 不要问 yes or no.
      gnus-large-newsgroup 500)		; 超过500封信, 先问我要读几封

(setq gnus-thread-sort-functions        ; 此list为反向
         '(gnus-thread-sort-by-number   ; 先对文章的分数排序
           gnus-thread-sort-by-score))

;; (setq gnus-use-adaptive-scoring t)

(add-hook 'message-sent-hook 'gnus-score-followup-article)

(add-hook 'message-sent-hook 'gnus-score-followup-thread)

(setq gnus-summary-mark-below -100      ; 小於 -100 就算读过.
      gnus-score-find-score-files-function 'my-score-file
                                        ; 不同group有不同的游戏规则
      gnus-score-below-mark (string-to-char " "))
                                        ; 分数低的不用特别标记, 这样
                                        ; 有反效果.
;; (add-hook 'gnus-part-display-hook 'gnus-article-hide-citation)

;; (add-hook 'gnus-article-prepare-hook 'gnus-article-hide-citation-maybe)
;; (add-hook 'gnus-article-prepare-hook 'gnus-article-highlight)
;; (add-hook 'gnus-article-prepare-hook 'gnus-article-hide-headers-if-wanted)
;; (add-hook 'gnus-article-prepare-hook 'gnus-article-hide-boring-headers)
;; (add-hook 'gnus-article-prepare-hook 'gnus-article-emphasize)
(setq gnus-treat-hide-citation-maybe t)
(setq gnus-treat-highlight-citation t)
(setq gnus-treat-hide-boring-headers 'head)
(setq gnus-treat-date-local t)
(setq gnus-treat-fold-headers 'head)
;; (setq gnus-default-adaptive-score-alist
;;   '((gnus-unread-mark)
;;     (gnus-ticked-mark (from 4))
;;     (gnus-dormant-mark (from 5))
;;     (gnus-del-mark (from -4) (subject -1))
;;     (gnus-read-mark (from 4) (subject 2))
;;     (gnus-expirable-mark (from -1) (subject -1))
;;     (gnus-killed-mark (from -1) (subject -3))
;;     (gnus-kill-file-mark)
;;     (gnus-ancient-mark)
;;     (gnus-low-score-mark)
;;     (gnus-catchup-mark (from -1) (subject -1))))

;; (setq gnus-default-adaptive-word-score-alist
;;       `((,gnus-read-mark . 30)
;;         (,gnus-catchup-mark . -10)
;;         (,gnus-killed-mark . -20)
;;         (,gnus-del-mark . -15)))
(defun my-score-file (group-name)
   (mapcar
    '(lambda (filename)
      (expand-file-name (concat "~/News/" filename)))
    (list "all.SCORE"
          (cond ((string-match "cn\\.bbs" group-name)
                 "cnbbs.SCORE")
                (t
                 (concat group-name ".SCORE"))))))

;; (setq mail-sources '((file :path "~/Mail/Inbox")))
(setq gnus-use-cache 'passive)          ; * 保存帖子到缓存, M-* 去掉
;; (defun date (u) 
;;    (concat u (format-time-string ".%Y-%m" (current-time))))

;; (setq nnmail-treat-duplicates 'delete
;;       nnmail-crosspost nil		       ; 同一个邮件不要到多个组
;;       nnmail-split-methods 'nnmail-split-fancy ; 这个分类方法比较灵活
;;       nnmail-split-fancy-match-partial-words t ; 单词部分匹配也算成功匹配
;;       nnmail-split-fancy
;;       `(| ;; 根据 mailing list 分类
;; 	(any "kde-china@kde.org" ,(date "list.kde-china"))
;; 	(any "xetex@tug.org" ,(date "list.xetex"))
;; 	(any "ubuntu-zh@lists.ubuntu.com" ,(date "list.ubuntu-zh"))
;; 	(any "python-chinese@lists.python.cn" ,(date "list.python-china"))
;; 	(any "gentoo-user@lists.gentoo.org", (date "list.gentoo"))
;; 	(any "ding@gnus.org" "list.ding")
;; 	;;(any "fetchmail-friends" "list.fetchmail")
;; 	;;(any "zope@zope.org" "list.zope")
;; 	(to "ustczhan@gmail.com\\|abxeeled@mail.ustc.edu.cn"
;; 	    ;; \\|sss@aa" ;; 直接给我的再分类
;; 	    (| (any "ustc.edu" ,(date "mail.ustc")) ;; 从 ustc 给自己转发的邮件
;; 	       ;; ... 这里省去了一些 (from ...)
;; 	       (from "lupaworld@lupaworld.com" "mail.Lupa")
;; 	       (from "@gmail.com" "mail.gmail")
;; 	       (from "a-.*@.*.com" "mail.junk")
;; 	       "mail.misc"))
;; 	"mail.junk")) 

;; (setq nnmail-expiry-wait-function
;;    (lambda (group)
;;      (cond ((string= group "mail.ustc")
;;              31)
;;            ((string= group "mail.misc")
;;              3)
;;            ((string= group "mail.Ben")
;;              'never)
;;            ((string= group "list.kde-china")
;; 	    3)
;; 	   ((string= group "list.ubuntu-zh")
;; 	    3)
;;            ((string= group "mail.Lupa")
;; 	    3)
;; 	   ((string= group "mail.junk")
;; 	    'immediate)
;;            (t
;;              6))))

;; (setq nnmail-expiry-target "nnml:expired")
;; (setq nnmail-expiry-target 'nnmail-fancy-expiry-target
;;       nnmail-fancy-expiry-targets
;;       '((to-from ".*ustc.edu.*" 
;; 		 "nnfolder:expired.ustc")
;; 	;;(concat "nnmail:expired.ustc." (format-time-string
;; 	;;		    "%Y-%m" (current-time))))
;; 	(to-from ".*ubuntu.*" "nnfolder:expired.ubuntu-zh")
;; 	(to-from ".*kde.*" "nnfolder:expired.kde-china")
;; 	(to-from ".*xetex.*" "nnfolder:expired.xetex")
;; 	(to-from ".*" "nnfolder:Archive-%Y")))
;; (concat "nnmail:expired.misc." (format-time-string
;;			  "%Y-%m" (current-time))))))
	
;; (setq gnus-auto-expirable-newsgroups "^nnml:mail.junk") 

(setq gnus-message-archive-group
      '((if (message-news-p)
            "nnml:Sent-News"
	  (concat "nnml:mail.sent." (format-time-string
				     "%Y-%m" (current-time))))))
          
(defun prefer-gb2312 ()
  (setq mm-coding-system-priorities
        '(iso-8859-15 gb2312 utf-8)))

(defun prefer-utf-8 ()
  (setq mm-coding-system-priorities
        '(iso-8859-15 utf-8)))
        
(setq gnus-posting-styles
      '((".*"
         (name "name1")
         (From "Zhan <ustczhan@gmail.com>")
         (eval (prefer-gb2312)))
        ("^cn\\.bbs.*"
         (name "name2")
         (From "Zhan <ustczhan@gmail.com>")
         (eval (prefer-gb2312)))
        ("INBOX\\.*"
         (name "name3")
         (From "Zhan <ustczhan@gmail.com>")
         (eval (prefer-utf-8)))
	("nnimap\\+ustc:*"
	 (name "name4")
	 (From "email4")
	 (eval (prefer-gb2312)))))


(setq sendmail-program "/usr/sbin/ssmtp") ;; 设定 sendmail 程序
;;===================回复时不引用签名档==========================
(setq message-cite-function
      'message-cite-original-without-signature)

;;==================据说这样可以将news 和 mail 打包保存===========
(setq gnus-message-archive-group 
      '((if (message-news-p) 
            (concat "news." (format-time-string "%Y-%m")) 
          (concat "mail." (format-time-string "%Y-%m"))))) 

;;===============自动显示ascii颜色字串==========================
(autoload 'ansi-color-apply-on-region "ansi-color")
(defun article-treat-ansi-sequences ()
  "Translate ANSI SGR control sequences into overlays or extents."
  (interactive)
  (save-excursion
    (when (article-goto-body)

      (let ((inhibit-read-only t))
        (ansi-color-apply-on-region (point) (point-max))))))
(add-hook 'gnus-part-display-hook
	  'article-treat-ansi-sequences)
;; (add-hook 'gnus-part-display-hook 'gnus-article-highlight-citation)

;;==============加快速度=======================================
(gnus-compile)