emacs
 

我的.emacs文件

(setq default-major-mode 'text-mode);一打开就起用 text 模式。
(global-font-lock-mode t);语法高亮
(auto-image-file-mode t);打开图片显示功能
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no,可能你觉得不需要,呵呵。
(column-number-mode t);显示列号
(show-paren-mode t);显示括号匹配
(display-time-mode 1);显示时间,格式如下
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(tool-bar-mode nil);去掉那个大大的工具栏
(scroll-bar-mode nil);去掉滚动条,因为可以使用鼠标滚轮了 ^_^
(mouse-avoidance-mode 'animate);光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线。很好玩阿,这个功能
(setq mouse-yank-at-point t);支持中键粘贴
(transient-mark-mode t);这个忘了,郁闷!
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(setq frame-title-format "drazet@%b");在标题栏提示你目前在什么位置。你要把drazet改成自己的用户名
(setq default-fill-column 80);默认显示 80列就换行
  (add-hook 'texinfo-mode-hook (lambda () (require 'sb-texinfo)))
     (load-file "/home/drazet/myEmacs/cedet-1.0pre3/common/cedet.el")
     (semantic-load-enable-code-helpers)
     (autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
     (autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
     (define-key-after (lookup-key global-map [menu-bar tools])
                                       [speedbar]
                                       '("Speedbar" .
                                       speedbar-frame-mode)
                                       [calendar])
(add-to-list 'load-path "/home/drazet/myEmacs/ecb-2.32")
(require 'ecb)


;;设置tab为4个空格的宽度,而不是原来的2
(setq default-tab-width 4)
;;禁用启动信息
(setq inhibit-startup-message t)
(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(canlock-password "124d0810f8d3e778a58ad6016e6f93da3f282613")
 '(ecb-options-version "2.32"))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )

;;启用c语言函数高亮
;(font-lock-add-keywords 'c-mode '(("\\([a-zA-Z_][a-zA-Z0-9_]*\\)\\s-*(" 1
;font-lock-function-name-face)) t)

;;GNUS Setting
;;Gnus 是个古老的,强大的邮件,新闻阅读lisp程序.
;;设置头像文件可惜我一直没搞定
;(setq message-required-news-headers
;       (nconc message-required-news-headers
;              (list '(X-Face . gnus-random-x-face))))

;;用户资料设定
(setq user-full-name "Drazet")
(setq user-mail-address "drazet@nbyteam.org")

;;服务器的设定
(setq gnus-select-method '(nntp "news.yaako.com"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "news.newsfan.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 72);;这里的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))   ;; 忽略编码

;; 改变阅读新闻时窗口的布局,窗口划分为上4下6(比例)
(gnus-add-configuration '(article
                          (vertical 1.0
                                    (summary .4 point)
                                    (article 1.0))))

;;开启记分
(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)

(defvar gnus-default-adaptive-score-alist
    '((gnus-kill-file-mark (from -10))
        (gnus-unread-mark)
 (gnus-read-mark (from 10) (subject 30))
 (gnus-catchup-mark (subject -10))
 (gnus-killed-mark (from -1) (subject -30))
 (gnus-del-mark (from -2) (subject -15))
 (gnus-ticked-mark (from 10))
 (gnus-dormant-mark (from 5))))

(setq  gnus-score-find-score-files-function
       '(gnus-score-find-hierarchical gnus-score-find-bnews bbdb/gnus-score)
       gnus-use-adaptive-scoring t)

;;;
(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))

;另外,有些用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")))

;;设置头像文件
(setq gnus-posting-styles
      '((".*"
         (name "drazet")
         (face "")
         ;;这个我都是抄老外的,自己找去,在Gnus里看到好的头像,然后到
         ;;groups.google里把他的字符串贴过来 -_-!
         (address "drazet@nbyteam.org")
         (organization "www.nbyteam.org")
         (signature "
           A za a za fighting!")
         )
))

;;选择几个自己喜欢的新闻组,作为默认的新闻组
(setq gnus-default-subscribed-newsgroups
  '("gnu.emacs.help"     ;; 这里不错噢,有关 emacs 使用的问题都在这里讨论
    "cn.comp.os.linux" ;; 这里也有一个 emacs 小团伙
    "cn.fan"))

;;邮件设置
(setq mail-sources
      '((pop :server "mail.neusoft.com"   ;; 在这里设置 pop3 服务器
             :user "xupf"            ;; 用户名
             :port "pop3"
             :password "password"))) ;; 密码


(setq gnus-secondary-select-methods '((nnml "")))


(setq user-full-name "Drazet") ;; 外发的邮件采用这个名字
(setq user-mail-address "xupf@neusoft.com") ;;外发的邮件采用这个地址[+如果smtp为163,地址必须为xxx@163.com,而且 mail/smtpmail.el 必须足够新!+]
(setq smtpmail-auth-credentials
    '(("mail.neusoft.com"  ;; SMTP 服务器
       25
       "xupf"          ;; 用户名
       "password")))   ;; 密码
(setq smtpmail-default-smtp-server "mail.neusoft.com")
(setq smtpmail-smtp-server "mail.neusoft.com")
(setq message-send-mail-function 'smtpmail-send-it)

;;有些用 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")))