2006年9月21日

我的EMACS配置文件

.emacs

(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.
'(current-language-environment "Chinese-GB18030")
'(default-input-method "chinese-py-punct")
'(display-time-mode t)
'(show-paren-mode t)
'(transient-mark-mode t))
(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.
)

(global-set-key [f1] 'info)
(global-set-key [f2] 'dired-jump)
(global-set-key [f3] 'ibuffer)
(global-set-key [f4] 'kill-this-buffer)
(global-set-key [f5] 'gnus)
(global-set-key [f6] 'erc)
(global-set-key [f7] 'w3m-browse-url)
(global-set-key [f8] 'dictionary-search)
(global-set-key [f9] 'eshell)
(global-set-key [f10] 'tmm-menubar)
(global-set-key [f11] 'calendar)
(global-set-key [f12] 'list-bookmarks)

(global-set-key (kbd "M-/") 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name-partially
try-complete-file-name
try-expand-all-abbrevs
try-expand-list
try-expand-line
try-complete-lisp-symbol-partially
try-complete-lisp-symbol))

(global-set-key "%" 'match-paren)
(defun match-paren (arg) "Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))

(fset 'yes-or-no-p 'y-or-n-p)
(auto-image-file-mode)
(auto-compression-mode)
(global-font-lock-mode t)
(mouse-avoidance-mode 'animate)
(setq show-paren-style 'parentheses)
(setq inhibit-startup-message t)
(setq gnus-inhibit-startup-message t)
(setq x-stretch-cursor t)
(setq x-select-enable-clipboard t)
(setq scroll-margin 3)
(setq scroll-conservatively 10000)
(setq make-backup-files nil)
(setq appt-issue-message t)
(setq track-oel t)
(setq kill-ring-max 100)
(setq default-major-mode 'text-mode)
(setq calendar-remove-frame-by-deleting t)
(setq calendar-week-start-day 1)
(setq view-diary-entries-initially t)
(setq display-time-24hr-format t
display-time-day-and-date t
display-time-interval 10)

(setq bookmark-default-file "~/.emacs.d/.bookmark"
bbdb-file "~/.emacs.d/.bbdb"
diary-file "~/.emacs.d/.diary"
todo-file-do "~/.emacs.d/.todo-do"
todo-file-done "~/.emacs.d/.todo-done"
todo-file-top "~/.emacs.d/.todo-top")

(setq user-full-name "winsphinX"
user-mail-address "winsphinx@xxx.com"
diary-mail-addr "winsphinx@xxx.com")
(add-hook 'diary-hook 'appt-make-list)

(setq calendar-latitude +30.0072
calendar-longitude +120.5749
calendar-location-name "绍兴")

(setq chinese-calendar-celestial-stem
["甲" "乙" "丙" "丁" "戊" "己" "庚" "辛" "壬" "癸"])
(setq chinese-calendar-terrestrial-branch
["子" "丑" "寅" "卯" "辰" "巳" "午" "未" "申" "酉" "戌" "亥"])

(setq christian-holidays nil
hebrew-holidays nil
islamic-holidays nil)
(setq solar-n-hemi-seasons '("春分" "夏至" "秋分" "冬至"))
(setq general-holidays '((holiday-fixed 1 1 "元旦")
(holiday-fixed 2 14 "情人节")
(holiday-fixed 3 12 "植树节")
(holiday-fixed 4 1 "愚人节")
(holiday-fixed 5 1 "劳动节")
(holiday-float 5 0 2 "母亲节")
(holiday-fixed 6 1 "儿童节")
(holiday-float 6 0 3 "父亲节")
(holiday-fixed 7 1 "建党节")
(holiday-fixed 8 1 "建军节")
(holiday-fixed 9 10 "教师节")
(holiday-fixed 10 1 "国庆节")
(holiday-float 11 4 4 "感恩节")
(holiday-fixed 12 25 "圣诞节")))

(setq gnus-select-method '(nntp "news.yaako.com")
gnus-secondary-select-methods
'((nnfolder "")
(nntp "news.newsfan.net")))
(setq gnus-posting-styles '(((message-mail-p)
(name "winsphinX")
(address "winsphinx@xxx.com"))
((message-news-p)
(name "winsphinX")
(address "xxx@yyy.zzz"))))
(setq gnus-read-newsrc-file nil
gnus-save-newsrc-file nil)
(setq gnus-use-cache 'passive)
(setq pop3-leave-mail-on-server t)
(setq message-cite-function 'message-cite-original-without-signature)
(add-hook 'mail-citation-hook 'sc-cite-original)
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
(add-hook 'gnus-article-prepare-hook 'gnus-article-date-local)
(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)
gnus-summary-show-article-charset-alist '((1 . cn-gb-2312) (2 . big5) (3 . gbk) (4 . utf-8)))
(setq gnus-message-archive-group
'((if (message-news-p)
"nnfolder:mail.sent.news"
"nnfolder:mail.sent.mail")))

(eval-after-load "mm-decode"
'(progn (add-to-list 'mm-discouraged-alternatives "text/html")
(add-to-list 'mm-discouraged-alternatives "text/richtext")))
(defalias 'mail-header-encode-parameter 'rfc2047-encode-parameter)

(setq mail-sources
'((pop :user "winsphinx" :password "******" :server "pop3.xxx.com" :port 110)))

(setq send-mail-function 'smtpmail-send-it
message-send-mail-function 'smtpmail-send-it
smtpmail-smtp-server "smtp.xxx.com"
smtpmail-default-smtp-server "smtp.xxx.com"
smtpmail-auth-credentials '(("smtp.xxx.com" 25 "winsphinx" "******")))

(require 'dired-x)
(setq dired-recursive-copies 'top
dired-recursive-deletes 'top)

(require 'bbdb)
(bbdb-initialize 'gnus 'message)
(setq bbdb-north-american-phone-numbers-p nil
bbdb-check-zip-codes-p nil
bbdb-user-mail-name "winsphinx@xxx.com"
bbdb-complete-name-allow-cycling t
bbdb-use-pop-up nil)

(require 'emms-setup)
(emms-devel)
(setq emms-player-mplayer-command-name "mplayer"
emms-player-mplayer-parameters '("-slave")
emms-player-list '(emms-player-mplayer
emms-player-mplayer-playlist))
(setq emms-source-file-default-directory "~/music/songs"
emms-lyrics-dir "~/music/lyrics")
(setq emms-info-mp3info-coding-system 'cn-gb-2312
emms-lyrics-coding-system 'cn-gb-2312
emms-cache-file-coding-system 'cn-gb-2312)
(setq emms-mode-line-format "[%s]"
emms-lyrics-display-format "%s"
emms-playing-time-display-format "%s")
(add-hook 'emms-player-started-hook 'emms-show)

(global-set-key (kbd "C-c e TAB") 'emms-playlist-mode-go-popup)
(global-set-key (kbd "C-c e t") 'emms-play-directory-tree)
(global-set-key (kbd "C-c e x") 'emms-start)
(global-set-key (kbd "C-c e v") 'emms-stop)
(global-set-key (kbd "C-c e n") 'emms-next)
(global-set-key (kbd "C-c e p") 'emms-previous)
(global-set-key (kbd "C-c e o") 'emms-show)
(global-set-key (kbd "C-c e s") 'emms-shuffle)
(global-set-key (kbd "C-c e l") 'emms-play-playlist)
(global-set-key (kbd "C-c e SPC") 'emms-pause)
(global-set-key (kbd "C-c e a") 'emms-add-directory-tree)
(global-set-key (kbd "C-c e r") 'emms-toggle-repeat-track)
(global-set-key (kbd "C-c e R") 'emms-toggle-repeat-playlist)
(global-set-key (kbd "C-c e f") 'emms-play-file)
(global-set-key (kbd "C-c e d") 'emms-play-directory)
(global-set-key (kbd "C-c e m") 'emms-lyrics-toggle-display-on-minibuffer)
(global-set-key (kbd "C-c e M") 'emms-lyrics-toggle-display-on-modeline)
(global-set-key (kbd "C-c e <left>") (lambda () (interactive) (emms-seek -10)))
(global-set-key (kbd "C-c e <right>") (lambda () (interactive) (emms-seek +10)))
(global-set-key (kbd "C-c e <down>") (lambda () (interactive) (emms-seek -60)))
(global-set-key (kbd "C-c e <up>") (lambda () (interactive) (emms-seek +60)))

(require 'erc)
(require 'erc-list)
(require 'erc-nicklist)
(add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
(setq erc-encoding-default 'chinese-iso-8bit)

(require 'dictionary)
(setq dictionary-server "localhost")

(require 'w3m)
(setq w3m-use-cookies t)
(setq w3m-command-arguments '("-cookie" "-F"))
(setq w3m-bookmark-file-coding-system 'cn-gb-2312)
(setq browse-url-browser-function 'w3m-browse-url)

没有评论: