就像专业厨师随身带着自已的厨具,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.
'(inhibit-startup-screen 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.
)
;=======================================================================
;;slime
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(add-to-list 'load-path "~/lisp/slime")
(require 'slime)
(slime-setup)
;=======================================================================
;; Show line number
(global-linum-mode t)
;=======================================================================
;; 设置tab为4个空格的宽度,而不是原来的2
(setq c-basic-offset 4)
(setq default-tab-width 4)
(setq-default indent-tabs-mode nil)
;=======================================================================
;; Start server 用法:emacsclient FILE [-c]
(server-start)
;=======================================================================
;;;hippie-expand
;;;Download http://ptolemy.eecs.berkeley.edu/~johnr/info/nt/hippie-expand.el
(global-set-key (kbd "M-/") 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev ; 搜索当前 buffer
try-expand-dabbrev-visible ; 搜索当前可见窗口
try-expand-dabbrev-all-buffers ; 搜索所有 buffer
try-expand-dabbrev-from-kill ; 从 kill-ring 中搜索
try-complete-file-name-partially ; 文件名部分匹配
try-complete-file-name ; 文件名匹配
try-expand-all-abbrevs ; 匹配所有缩写词
try-expand-list ; 补全一个列表
try-expand-line ; 补全当前行
try-complete-lisp-symbol-partially ; 部分补全 elisp symbol
try-complete-lisp-symbol)) ; 补全 lisp symbol
;======================================================================
;;; ibus
;;; Download: https://launchpad.net/ibus.el
(add-to-list 'load-path "~/.emacs.d/ibus-el-0.3.2")
(require 'ibus)
(add-hook 'after-init-hook 'ibus-mode-on)
(ibus-mode t)
;======================================================================
;;; Unicad (Auto detect text encoding."
;;; http://www.emacswiki.org/emacs/Unicad
(add-to-list 'load-path "~/.emacs.d/")
(require 'unicad)
;======================================================================
;;; Color theme
;;; Download: http://docs.huihoo.com/homepage/shredderyin/src/emacs-lisp/color-theme.el.gz
(require 'color-theme)
;;Set color theme to Robin Hood:
(defun my-color-theme ()
"Color theme of herbertdai, created 2012-08-01."
(interactive)
(color-theme-install
'(my-color-theme
((background-color . "#304020")
(background-mode . dark)
(border-color . "black")
(cursor-color . "LightGray")
(foreground-color . "navajo white")
(mouse-color . "Grey"))
((goto-address-mail-face . message-header-to-face)
(goto-address-mail-mouse-face . secondary-selection)
(goto-address-url-face . info-xref)
(goto-address-url-mouse-face . highlight)
(list-matching-lines-buffer-name-face . underline)
(list-matching-lines-face . bold)
(view-highlight-face . highlight)
(widget-mouse-face . highlight))
(default ((t (:stipple nil :background "#304020" :foreground "navajo white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
(bbdb-company ((t (:foreground "pale green"))))
(bbdb-field-name ((t (:foreground "medium sea green"))))
(bbdb-field-value ((t (:foreground "dark sea green"))))
(bbdb-name ((t (:bold t :foreground "pale green" :weight bold))))
(bg:erc-color-face0 ((t (nil))))
(bg:erc-color-face1 ((t (nil))))
(bg:erc-color-face10 ((t (nil))))
(bg:erc-color-face11 ((t (nil))))
(bg:erc-color-face12 ((t (nil))))
(bg:erc-color-face13 ((t (nil))))
(bg:erc-color-face14 ((t (nil))))
(bg:erc-color-face15 ((t (nil))))
(bg:erc-color-face2 ((t (nil))))
(bg:erc-color-face3 ((t (nil))))
(bg:erc-color-face4 ((t (nil))))
(bg:erc-color-face5 ((t (nil))))
(bg:erc-color-face6 ((t (nil))))
(bg:erc-color-face7 ((t (nil))))
(bg:erc-color-face8 ((t (nil))))
(bg:erc-color-face9 ((t (nil))))
(bold ((t (:bold t :weight bold))))
(bold-italic ((t (:italic t :bold t :foreground "beige" :slant italic :weight bold))))
(border ((t (:background "black"))))
(buffer-menu-buffer ((t (:bold t :weight bold))))
(button ((t (:underline t))))
(calendar-today-face ((t (:underline t))))
(change-log-acknowledgement-face ((t (:foreground "LightBlue"))))
(change-log-conditionals-face ((t (:bold t :foreground "Aquamarine" :weight bold))))
(change-log-date-face ((t (:foreground "LightSalmon"))))
(change-log-email-face ((t (:bold t :foreground "Aquamarine" :weight bold))))
(change-log-file-face ((t (:bold t :foreground "Aquamarine" :weight bold))))
(change-log-function-face ((t (:bold t :foreground "Aquamarine" :weight bold))))
(change-log-list-face ((t (:foreground "Salmon"))))
(change-log-name-face ((t (:foreground "Aquamarine"))))
(comint-highlight-prompt ((t (:foreground "medium aquamarine"))))
(completions-annotations ((t (:italic t :slant italic))))
(completions-common-part ((t (:family "DejaVu Sans Mono" :foundry "unknown" :width normal :weight normal :slant normal :underline nil :overline nil :strike-through nil :box nil :inverse-video nil :foreground "navajo white" :background "#304020" :stipple nil :height 98))))
(completions-first-difference ((t (:bold t :weight bold))))
(cperl-array-face ((t (:foreground "Yellow"))))
(cperl-hash-face ((t (:foreground "White"))))
(cperl-nonoverridable-face ((t (:foreground "SkyBlue"))))
(cursor ((t (:background "LightGray"))))
(custom-button-face ((t (:bold t :foreground "DodgerBlue1" :underline t :weight bold))))
(custom-documentation-face ((t (:foreground "Grey"))))
(custom-group-tag-face ((t (:foreground "MediumAquamarine"))))
(custom-state-face ((t (:foreground "LightSalmon"))))
(custom-variable-tag-face ((t (:foreground "Aquamarine"))))
(diary-face ((t (:foreground "IndianRed"))))
(diff-added-face ((t (nil))))
(diff-changed-face ((t (nil))))
(diff-context-face ((t (:foreground "grey70"))))
(diff-file-header-face ((t (:bold t :weight bold))))
(diff-function-face ((t (:foreground "grey70"))))
(diff-header-face ((t (:foreground "light salmon"))))
(diff-hunk-header-face ((t (:foreground "light salmon"))))
(diff-index-face ((t (:bold t :weight bold))))
(diff-nonexistent-face ((t (:bold t :weight bold))))
(diff-removed-face ((t (nil))))
(dired-face-directory ((t (:bold t :foreground "sky blue" :weight bold))))
(dired-face-executable ((t (:foreground "green yellow"))))
(dired-face-flagged ((t (:foreground "tomato"))))
(dired-face-marked ((t (:foreground "light salmon"))))
(dired-face-permissions ((t (:foreground "aquamarine"))))
(erc-action-face ((t (nil))))
(erc-bold-face ((t (:bold t :weight bold))))
(erc-current-nick-face ((t (:bold t :foreground "yellow" :weight bold))))
(erc-default-face ((t (nil))))
(erc-direct-msg-face ((t (:foreground "pale green"))))
(erc-error-face ((t (:bold t :foreground "IndianRed" :weight bold))))
(erc-highlight-face ((t (:bold t :foreground "pale green" :weight bold))))
(erc-input-face ((t (:foreground "light blue"))))
(erc-inverse-face ((t (:background "steel blue"))))
(erc-notice-face ((t (:foreground "light salmon"))))
(erc-pal-face ((t (:foreground "pale green"))))
(erc-prompt-face ((t (:bold t :foreground "light blue" :weight bold))))
(escape-glyph ((t (:foreground "cyan"))))
(eshell-ls-archive-face ((t (:bold t :foreground "IndianRed" :weight bold))))
(eshell-ls-backup-face ((t (:foreground "Grey"))))
(eshell-ls-clutter-face ((t (:foreground "DimGray"))))
(eshell-ls-directory-face ((t (:bold t :foreground "MediumSlateBlue" :weight bold))))
(eshell-ls-executable-face ((t (:foreground "Coral"))))
(eshell-ls-missing-face ((t (:foreground "black"))))
(eshell-ls-picture-face ((t (:foreground "Violet"))))
(eshell-ls-product-face ((t (:foreground "LightSalmon"))))
(eshell-ls-readonly-face ((t (:foreground "Aquamarine"))))
(eshell-ls-special-face ((t (:foreground "Gold"))))
(eshell-ls-symlink-face ((t (:foreground "White"))))
(eshell-ls-text-face ((t (:foreground "medium aquamarine"))))
(eshell-ls-todo-face ((t (:bold t :foreground "aquamarine" :weight bold))))
(eshell-ls-unreadable-face ((t (:foreground "DimGray"))))
(eshell-prompt-face ((t (:foreground "powder blue"))))
(fg:erc-color-face0 ((t (:foreground "white"))))
(fg:erc-color-face1 ((t (:foreground "beige"))))
(fg:erc-color-face10 ((t (:foreground "pale goldenrod"))))
(fg:erc-color-face11 ((t (:foreground "light goldenrod yellow"))))
(fg:erc-color-face12 ((t (:foreground "light yellow"))))
(fg:erc-color-face13 ((t (:foreground "yellow"))))
(fg:erc-color-face14 ((t (:foreground "light goldenrod"))))
(fg:erc-color-face15 ((t (:foreground "lime green"))))
(fg:erc-color-face2 ((t (:foreground "lemon chiffon"))))
(fg:erc-color-face3 ((t (:foreground "light cyan"))))
(fg:erc-color-face4 ((t (:foreground "powder blue"))))
(fg:erc-color-face5 ((t (:foreground "sky blue"))))
(fg:erc-color-face6 ((t (:foreground "dark sea green"))))
(fg:erc-color-face7 ((t (:foreground "pale green"))))
(fg:erc-color-face8 ((t (:foreground "medium spring green"))))
(fg:erc-color-face9 ((t (:foreground "khaki"))))
(file-name-shadow ((t (:foreground "grey70"))))
(fixed-pitch ((t (:family "Monospace"))))
(font-lock-builtin-face ((t (:bold t :foreground "PaleGreen" :weight bold))))
(font-lock-comment-delimiter-face ((t (:foreground "LightBlue"))))
(font-lock-comment-face ((t (:foreground "LightBlue"))))
(font-lock-constant-face ((t (:foreground "Aquamarine"))))
(font-lock-doc-face ((t (:foreground "LightSalmon"))))
(font-lock-doc-string-face ((t (:foreground "LightSalmon"))))
(font-lock-function-name-face ((t (:bold t :foreground "Aquamarine" :weight bold))))
(font-lock-keyword-face ((t (:foreground "Salmon"))))
(font-lock-negation-char-face ((t (nil))))
(font-lock-preprocessor-face ((t (:foreground "Salmon"))))
(font-lock-reference-face ((t (:foreground "pale green"))))
(font-lock-regexp-grouping-backslash ((t (:bold t :weight bold))))
(font-lock-regexp-grouping-construct ((t (:bold t :weight bold))))
(font-lock-string-face ((t (:foreground "LightSalmon"))))
(font-lock-type-face ((t (:bold t :foreground "YellowGreen" :weight bold))))
(font-lock-variable-name-face ((t (:bold t :foreground "Aquamarine" :weight bold))))
(font-lock-warning-face ((t (:bold t :foreground "red" :weight bold))))
(fringe ((t (:background "#003700"))))
(gnus-cite-attribution-face ((t (:bold t :weight bold))))
(gnus-cite-face-1 ((t (:foreground "LightSalmon"))))
(gnus-cite-face-2 ((t (:foreground "Khaki"))))
(gnus-cite-face-3 ((t (:foreground "Coral"))))
(gnus-cite-face-4 ((t (:foreground "yellow green"))))
(gnus-cite-face-5 ((t (:foreground "dark khaki"))))
(gnus-cite-face-6 ((t (:foreground "bisque"))))
(gnus-cite-face-7 ((t (:foreground "peru"))))
(gnus-cite-face-8 ((t (:foreground "light coral"))))
(gnus-cite-face-9 ((t (:foreground "plum"))))
(gnus-emphasis-bold ((t (:bold t :weight bold))))
(gnus-emphasis-bold-italic ((t (:italic t :bold t :slant italic :weight bold))))
(gnus-emphasis-highlight-words ((t (:background "black" :foreground "yellow"))))
(gnus-emphasis-italic ((t (:italic t :slant italic))))
(gnus-emphasis-underline ((t (:underline t))))
(gnus-emphasis-underline-bold ((t (:bold t :underline t :weight bold))))
(gnus-emphasis-underline-bold-italic ((t (:italic t :bold t :underline t :slant italic :weight bold))))
(gnus-emphasis-underline-italic ((t (:italic t :underline t :slant italic))))
(gnus-group-mail-1-empty-face ((t (:foreground "White"))))
(gnus-group-mail-1-face ((t (:bold t :foreground "White" :weight bold))))
(gnus-group-mail-2-empty-face ((t (:foreground "light cyan"))))
(gnus-group-mail-2-face ((t (:bold t :foreground "light cyan" :weight bold))))
(gnus-group-mail-3-empty-face ((t (:foreground "LightBlue"))))
(gnus-group-mail-3-face ((t (:bold t :foreground "LightBlue" :weight bold))))
(gnus-group-mail-low-empty-face ((t (:foreground "Aquamarine"))))
(gnus-group-mail-low-face ((t (:bold t :foreground "Aquamarine" :weight bold))))
(gnus-group-news-1-empty-face ((t (:foreground "White"))))
(gnus-group-news-1-face ((t (:bold t :foreground "White" :weight bold))))
(gnus-group-news-2-empty-face ((t (:foreground "light cyan"))))
(gnus-group-news-2-face ((t (:bold t :foreground "light cyan" :weight bold))))
(gnus-group-news-3-empty-face ((t (:foreground "LightBlue"))))
(gnus-group-news-3-face ((t (:bold t :foreground "LightBlue" :weight bold))))
(gnus-group-news-4-empty-face ((t (:foreground "Aquamarine"))))
(gnus-group-news-4-face ((t (:bold t :foreground "Aquamarine" :weight bold))))
(gnus-group-news-5-empty-face ((t (:foreground "MediumAquamarine"))))
(gnus-group-news-5-face ((t (:bold t :foreground "MediumAquamarine" :weight bold))))
(gnus-group-news-6-empty-face ((t (:foreground "MediumAquamarine"))))
(gnus-group-news-6-face ((t (:bold t :foreground "MediumAquamarine" :weight bold))))
(gnus-group-news-low-empty-face ((t (:foreground "MediumAquamarine"))))
(gnus-group-news-low-face ((t (:bold t :foreground "MediumAquamarine" :weight bold))))
(gnus-header-content-face ((t (:foreground "LightSkyBlue3"))))
(gnus-header-from-face ((t (:bold t :foreground "light cyan" :weight bold))))
(gnus-header-name-face ((t (:bold t :foreground "LightBlue" :weight bold))))
(gnus-header-newsgroups-face ((t (:bold t :foreground "MediumAquamarine" :weight bold))))
(gnus-header-subject-face ((t (:bold t :foreground "light cyan" :weight bold))))
(gnus-signature-face ((t (:foreground "Grey"))))
(gnus-splash-face ((t (:foreground "ForestGreen"))))
(gnus-summary-cancelled-face ((t (:background "Black" :foreground "Yellow"))))
(gnus-summary-high-ancient-face ((t (:bold t :foreground "MediumAquamarine" :weight bold))))
(gnus-summary-high-read-face ((t (:bold t :foreground "Aquamarine" :weight bold))))
(gnus-summary-high-ticked-face ((t (:bold t :foreground "LightSalmon" :weight bold))))
(gnus-summary-high-unread-face ((t (:bold t :foreground "beige" :weight bold))))
(gnus-summary-low-ancient-face ((t (:foreground "DimGray"))))
(gnus-summary-low-read-face ((t (:foreground "slate gray"))))
(gnus-summary-low-ticked-face ((t (:foreground "Pink"))))
(gnus-summary-low-unread-face ((t (:foreground "LightGray"))))
(gnus-summary-normal-ancient-face ((t (:foreground "MediumAquamarine"))))
(gnus-summary-normal-read-face ((t (:foreground "Aquamarine"))))
(gnus-summary-normal-ticked-face ((t (:foreground "LightSalmon"))))
(gnus-summary-normal-unread-face ((t (nil))))
(gnus-summary-selected-face ((t (:background "DarkSlateBlue"))))
(header-line ((t (:background "#030" :foreground "#AA7" :box nil))))
(help-argument-name ((t (:italic t :slant italic))))
(highlight ((t (:background "PaleGreen" :foreground "DarkGreen"))))
(highline-face ((t (:background "SeaGreen"))))
(holiday-face ((t (:background "DimGray"))))
(hyper-apropos-documentation ((t (:foreground "LightSalmon"))))
(hyper-apropos-hyperlink ((t (:bold t :foreground "DodgerBlue1" :weight bold))))
(ido-subdir-face ((t (:foreground "MediumSlateBlue"))))
(info-menu-5 ((t (:underline t))))
(info-node ((t (:bold t :foreground "DodgerBlue1" :underline t :weight bold))))
(info-xref ((t (:bold t :foreground "DodgerBlue1" :weight bold))))
(isearch ((t (:background "sea green"))))
(isearch-fail ((t (:background "red4"))))
(italic ((t (:italic t :slant italic))))
(lazy-highlight ((t (:background "paleturquoise4"))))
(link ((t (:foreground "cyan1" :underline t))))
(link-visited ((t (:underline t :foreground "violet"))))
(match ((t (:background "RoyalBlue3"))))
(menu ((t (:background "#304020" :foreground "navajo white"))))
(message-cited-text-face ((t (:foreground "LightSalmon"))))
(message-header-cc-face ((t (:foreground "light cyan"))))
(message-header-name-face ((t (:foreground "LightBlue"))))
(message-header-newsgroups-face ((t (:bold t :foreground "MediumAquamarine" :weight bold))))
(message-header-other-face ((t (:foreground "MediumAquamarine"))))
(message-header-subject-face ((t (:bold t :foreground "light cyan" :weight bold))))
(message-header-to-face ((t (:bold t :foreground "light cyan" :weight bold))))
(message-header-xheader-face ((t (:foreground "MediumAquamarine"))))
(message-separator-face ((t (:foreground "chocolate"))))
(minibuffer-prompt ((t (:foreground "cyan"))))
(mode-line ((t (:background "dark olive green" :foreground "wheat"))))
(mode-line-buffer-id ((t (:bold t :background "dark olive green" :foreground "beige" :weight bold))))
(mode-line-emphasis ((t (:bold t :weight bold))))
(mode-line-highlight ((t (:box (:line-width 2 :color "grey40" :style released-button)))))
(mode-line-inactive ((t (:background "grey30" :foreground "grey80" :box (:line-width -1 :color "grey40" :style nil) :weight light))))
(modeline-mousable ((t (:background "dark olive green" :foreground "yellow green"))))
(modeline-mousable-minor-mode ((t (:background "dark olive green" :foreground "wheat"))))
(mouse ((t (:background "Grey"))))
(next-error ((t (:foreground "cyan" :background "dark cyan"))))
(nobreak-space ((t (:foreground "cyan" :underline t))))
(query-replace ((t (:background "sea green"))))
(region ((t (:background "dark cyan" :foreground "cyan"))))
(scroll-bar ((t (nil))))
(secondary-selection ((t (:background "Aquamarine" :foreground "SlateBlue"))))
(semantic-dirty-token-face ((t (:background "grey22"))))
(shadow ((t (:foreground "grey70"))))
(show-paren-match-face ((t (:bold t :background "Aquamarine" :foreground "steel blue" :weight bold))))
(show-paren-mismatch-face ((t (:background "Red" :foreground "White"))))
(tool-bar ((t (:background "#304020" :foreground "wheat" :box (:line-width 1 :style released-button)))))
(tooltip ((t (:family "Sans Serif" :background "lemon chiffon" :foreground "black"))))
(trailing-whitespace ((t (:background "red1"))))
(underline ((t (:underline t))))
(variable-pitch ((t (:family "Sans Serif"))))
(vertical-border ((t (nil))))
(w3m-anchor-face ((t (:bold t :foreground "DodgerBlue1" :weight bold))))
(w3m-arrived-anchor-face ((t (:bold t :foreground "DodgerBlue3" :weight bold))))
(w3m-header-line-location-content-face ((t (:background "dark olive green" :foreground "wheat"))))
(w3m-header-line-location-title-face ((t (:background "dark olive green" :foreground "beige"))))
(widget-button ((t (:bold t :weight bold))))
(widget-button-pressed ((t (:foreground "red1"))))
(widget-documentation ((t (:foreground "lime green"))))
(widget-field ((t (:background "dim gray" :foreground "LightBlue"))))
(widget-inactive ((t (:foreground "DimGray"))))
(widget-single-line-field ((t (:background "dim gray" :foreground "LightBlue"))))
(woman-bold-face ((t (:bold t :weight bold))))
(woman-italic-face ((t (:foreground "beige"))))
(woman-unknown-face ((t (:foreground "LightSalmon"))))
(zmacs-region ((t (:background "dark cyan" :foreground "cyan")))))))
(my-color-theme)