我的.emacs配置
1 (set-foreground-color "black")
2 (set-background-color "white")
3 ;;(setq tags-file-name "/usr/include/TAGS")
4
5 ;;配色
6 (add-to-list 'load-path "~/dev/emacs-23.3/extern/blisp/")
7 (require 'color-theme) ;;引用color-theme脚本
8 (color-theme-initialize)
9 (color-theme-bl-longlongago)
10
11 ;;vinner mode for switch windows layout
12 (winner-mode t)
13
14 ;; Load CEDET
15 (load-file "~/dev/emacs-23.3/extern/cedet-1.0pre7/common/cedet.el")
16 ;; Enabling various SEMANTIC minor modes. See semantic/INSTALL for more ideas.
17 ;; Select one of the following:
18
19 ;; * This enables the database and idle reparse engines
20 ;;(semantic-load-enable-minimum-features)
21
22 ;; * This enables some tools useful for coding, such as summary mode
23 ;; imenu support, and the semantic navigator
24 (semantic-load-enable-code-helpers)
25
26 ;; * This enables even more coding tools such as the nascent intellisense mode
27 ;; decoration mode, and stickyfunc mode (plus regular code helpers)
28 (semantic-load-enable-guady-code-helpers)
29
30 ;; * This turns on which-func support (Plus all other code helpers)
31 (semantic-load-enable-excessive-code-helpers)
32
33 ;; This turns on modes that aid in grammar writing and semantic tool
34 ;; development. It does not enable any other features such as code
35 ;; helpers above.
36 (semantic-load-enable-semantic-debugging-helpers)
37
38 (setq semantic-edits-verbose-flag nil)
39
40 (eval-after-load "semantic-c"
41 '(dolist (d (list "/usr/include/c++/4.5"
42 "/usr/include/c++/4.5/backward"
43 "/usr/local/include"
44 "/usr/include"
45 "/usr/include/GL"
46 "/home/dev/ogre/OgreMain/include"
47 "/home/dev/ogre/OgreMain/include/GLX"
48 "/home/dev/ogre/OgreMain/include/GTK"
49 "/home/dev/ogre/ois-v1-3/include"
50 "/home/dev/ogre/ois-v1-3/include/linux"
51 ))
52 (semantic-add-system-include d)))
53 ;;下面配置一下semantic分析结果文件的存放目录。注意这个目录是要自己建立的。
54 (setq semanticdb-default-save-directory
55 (expand-file-name "~/.emacs.d/semanticdb"))
56 ;;头文件的查找目录定义好了,下面对 c-mode 做一些小小的定义:
57 (add-hook 'c-mode-common-hook
58 '(lambda()
59 (require 'cedet)
60 (ede-minor-mode t)
61
62 (add-to-list 'load-path "~/emacs-23.3/ecb-2.40")
63 (require 'ecb)
64 ;;;;这三个按键绑定按个人喜欢启用,除了第一个可以修改成自己喜欢的按键之外,另外两个都没有修改的意义。
65 ;;;;反正主要的补全就靠 semantic-complete-analyze-inline了,以后偷摸骗抢都靠它了。
66 ;;;;semantic-complete-self-inset也是调用semantic-complete-analyze-inline的。
67 (local-set-key (kbd "M-/") 'semantic-complete-analyze-inline)
68 (local-set-key "." 'semantic-complete-self-insert)
69 (local-set-key ">" 'semantic-complete-self-insert)
70 (c-toggle-auto-hungry-state 1)
71 (c-set-style "K&R")
72
73 ;;切换h<->cpp
74
75 (local-set-key (kbd "C-c o") 'eassist-switch-h-cpp)
76
77 ))
78
79 ;;幽灵一样
80 ;;(eval-after-load "semantic-complete"
81 ;;'(setq semantic-complete-inline-analyzer-displayor-class
82 ;;semantic-displayor-ghost))
83
84
85 ;; create a fontsets
86
87 ;;(set-default-font "-adobe-courier-medium-r-normal--14-*-*-*-p-*-fontset-courier")
88 ;(set-default-font "-outline-Courier New-medium-r-bold-bold-14-*-96-96-c-*-iso8859-1")
89 ;;(set-default-font "-outline-Courier New-*-r-bold-bold-15-*-*-*-c-*-iso8859-1")
90 (set-default-font "-unknown-DejaVu Sans Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1")
91
92 ;;编辑时不生成备份文件
93 (setq-default make-backup-files nil)
94
95 (custom-set-variables
96 ;; custom-set-variables was added by Custom.
97 ;; If you edit it by hand, you could mess it up, so be careful.
98 ;; Your init file should contain only one such instance.
99 ;; If there is more than one, they won't work right.
100 '(ecb-options-version "2.40"))
101 (custom-set-faces
102 ;; custom-set-faces was added by Custom.
103 ;; If you edit it by hand, you could mess it up, so be careful.
104 ;; Your init file should contain only one such instance.
105 ;; If there is more than one, they won't work right.
106 )
107
108
109 ;;Alt+X to Ctrl+x Ctrl+m
110 (global-set-key (kbd "C-x C-m") 'execute-extended-command)
111 (global-set-key (kbd "C-c C-m") 'execute-extended-command)
112
113 ;;backward-kill-word
114 (global-set-key (kbd "C-w") 'backward-kill-word)
115 (global-set-key (kbd "C-x C-k") 'kill-region)
116 (global-set-key (kbd "C-c C-k") 'kill-region)
117
118 ;error jump
119 (global-set-key (kbd "C-c '") 'next-error)
120 (global-set-key (kbd "C-c ;") 'previous-error)
121
122 ;;no menu and button
123 (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
124 (if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
125 (if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
126
127 ;;关闭备份
128 (setq make-backup-files nil)
认真写好每一行代码