1.在此建一个.emacs 文件
C:\Documents and Settings\jims_mrs\Application Data
.emacs
(load-file "D:/Program Files/Develop/ntemacs24/HOME/emacs.el" )
2.在Home放两个文件
emacs.el
1
2 ;;默认 C:\Documents and Settings\jims_mrs\Application Data
3 ;;(load-file "D:/Program Files/Develop/ntemacs24/HOME/emacs.el" )
4
5
6 (setenv "HOME" "D:/Program Files/Develop/ntemacs24/HOME")
7 (setenv "PATH"
8 (concat
9 "D:/Program Files/develop/ntemacs24/extbin;"
10 "D:/Program Files/develop/ntemacs24/bin;"
11 "D:/Program Files/develop/ntemacs24/unixbin;"
12 (getenv "PATH")
13 )
14 )
15 (setq exec-path (append exec-path '("D:/Program Files/develop/ntemacs24/unixbin")))
16 (setq exec-path (append exec-path '("D:/Program Files/develop/ntemacs24/extbin")))
17
18 (setenv "BOOST_BUILD_PATH" "D:/Program Files/Develop/boost_1_46_1/tools/build/v2;")
19
20
21 (load-file "D:/Program Files/Develop/ntemacs24/HOME/emacs2.el" )
22
23 ;; 动态加载的代码
24 ;; M-x load-file,
25 ;; M-x eval-buffer
emacs2.el
1
2
3 ;;!--基本说明------------------------------------------------------
4 ;; 1. 搜索 ;;!-- 作为分类
5 ;; 2. 基本设置
6 ;; 基本扩展
7 ;; 基本按键
8 ;; 复杂的扩展1 xcscope
9 ;; 复杂的扩展2 ecb cedet
10 ;; C++专用扩展
11
12
13
14 ;;!--基本设置------------------------------------------------------
15
16 (setq user-full-name "mrx jimsmorong");;设置个人信息
17
18 (setq user-mail-address "jimsmorong@gmail.com")
19
20 (display-time) ;;显示时间
21
22 (tool-bar-mode -1) ;;去掉工具栏
23
24 ;;(menu-bar-mode nil);;去掉菜单栏 ctrl+鼠标右键 可以按出菜单
25
26 (set-scroll-bar-mode nil);;去掉滚动条
27
28 (setq visible-bell t);;关闭烦人的出错时的提示声
29
30 (setq scroll-step 1 ;;滚动页面时比较舒服,不要整页的滚动
31 scroll-margin 3
32 scroll-conservatively 10000)
33
34 (setq frame-title-format "%b@emacs");在标题栏显示buffer的名字
35
36 (setq make-backup-files t);; backup policies
37 (setq version-control t)
38 (setq kept-old-versions 2)
39 (setq kept-new-versions 5)
40 (setq delete-old-versions t)
41 (setq backup-directory-alist '(("" . "~/emacs/backups")))
42
43 (setq bookmark-save-flag 1) ;;保存书签
44
45 ;;!--基本扩展------------------------------------------------------
46
47 ;;加载颜色
48 (require 'color-theme)
49 (eval-after-load "color-theme"
50 '(progn
51 (color-theme-initialize)
52 (color-theme-comidia)))
53
54 ;;配置ido插件 在用C-x C-f打开文件时 有提示
55 (require 'ido)
56 (ido-mode t)
57
58 ;;load browse-kill-ring
59 (require 'browse-kill-ring)
60 (global-set-key [(control c)(k)] 'browse-kill-ring)
61 (browse-kill-ring-default-keybindings)
62
63 (require 'recent-jump)
64 (setq recent-jump-threshold 4)
65 (setq recent-jump-ring-length 10)
66 (global-set-key (kbd "C-o") 'recent-jump-jump-backward)
67 (global-set-key (kbd "M-o") 'recent-jump-jump-forward)
68
69 (require 'window-numbering)
70 (window-numbering-mode 1)
71
72 ;;配置linum插件,显示行号
73 (require 'linum)
74 ;;(global-linum-mode t)
75
76 (require 'htmlize)
77
78
79 ;;!--基本按键------------------------------------------------------
80
81 ; F5:激活speedbar
82 (global-set-key [(f5)] 'speedbar-get-focus)
83
84 ;;动态增加减少字体大小
85 (defun sacha/increase-font-size ()
86 (interactive)
87 (set-face-attribute 'default
88 nil
89 :height
90 (ceiling (* 1.10
91 (face-attribute 'default :height)))))
92 (defun sacha/decrease-font-size ()
93 (interactive)
94 (set-face-attribute 'default
95 nil
96 :height
97 (floor (* 0.9
98 (face-attribute 'default :height)))))
99 (global-set-key (kbd "C-+") 'sacha/increase-font-size)
100 (global-set-key (kbd "C--") 'sacha/decrease-font-size)
101
102 ;;插入时间
103 (defun my-insert-date ()
104 (interactive)
105 (insert "//")
106 (insert (format-time-string "%Y/%m/%d %H:%M:%S" (current-time))))
107 (global-set-key (kbd "C-c m d") 'my-insert-date)
108
109 (defun my-insert-date2 ()
110 (interactive)
111 (insert (format-time-string "%H:%M:%S" (current-time))))
112 (global-set-key (kbd "C-c m t") 'my-insert-date2)
113
114 (defun remove-dos-eol ()
115 "Removes the disturbing '^M' showing up in files containing mixed UNIX and DOS line endings."
116 (interactive)
117 (setq buffer-display-table (make-display-table))
118 (aset buffer-display-table ?\^M []))
119
120
121 ;;;; 各窗口间切换
122 (global-set-key [M-left] 'winmove-left)
123 (global-set-key [M-right] 'windmove-right)
124 (global-set-key [M-up] 'windmove-up)
125 (global-set-key [M-down] 'windmove-down)
126
127 (global-set-key [(C-f4)] 'kill-this-buffer)
128
129
130 ;;!--复杂的扩展1 xcscope---------------------------------------------
131
132 ;;加载cscope
133 (require 'xcscope) ;;加载xcscope
134
135
136
137
138
139 ;;!--复杂的扩展2 ecb cedet---------------------------------------------
140
141
142
143 (require 'cedet) ;;加载cedet
144 (require 'ecb) ;;加载ecb
145 ;;;; 隐藏和显示ecb窗口
146 (define-key global-map [(control f1)] 'ecb-hide-ecb-windows)
147 (define-key global-map [(control f2)] 'ecb-show-ecb-windows)
148 ;;;; 使某一ecb窗口最大化
149 (define-key global-map "\C-c1" 'ecb-maximize-window-directories)
150 (define-key global-map "\C-c2" 'ecb-maximize-window-sources)
151 (define-key global-map "\C-c3" 'ecb-maximize-window-methods)
152 (define-key global-map "\C-c4" 'ecb-maximize-window-history)
153 ;;;; 恢复原始窗口布局
154 (define-key global-map "\C-c`" 'ecb-restore-default-window-sizes)
155
156
157 ;;!--C++专用扩展---------------------------------------------
158
159 ;;代码折叠
160 (add-hook 'c-mode-hook 'hs-minor-mode)
161 (add-hook 'c++-mode-hook 'hs-minor-mode)
162
163 ;; C++设置
164 (defun my-c++-mode-hook ()
165 (c-set-style "bsd"))
166 (add-hook 'c++-mode-hook 'my-c++-mode-hook)
167 (add-hook 'c-mode-hook 'my-c++-mode-hook)
168
169
170
171
172 ;;auto-complete-----------------------------------------------
173 (require 'auto-complete-config)
174 (ac-config-default)
175
176 ;;Type M-x load-file RET in the running Emacs or newly launched Emacs.
177 ;;Note that if you want to upgrade auto-complete-mode, you have to
178 ;;install in a newly launched Emacs with -q option. Then input a file
179 ;;name to load which is a path string with adding /etc/install.el to
180 ;;the package directory. For example, if the package directory is
181 ;;~/tmp/auto-complete-1.2, the file name will be
182 ;;~/tmp/auto-complete-1.2/etc/install.el.
183
184 ;;Then input a directory where Auto Complete will be installed.
185 ;;You need to add a directory to load-path later if load-path
186 ;;doesn't include the directory. The directory is to be ~/.emacs.d by default.
187
188 ;;Finally type RET to start installation. After installation,
189 ;;you may see the following buffer and follow instructions to edit .emacs.
190
191
192 (require 'muse-mode) ; load authoring mode
193
194 (require 'muse-html) ; load publishing styles I use
195 (require 'muse-latex)
196 (require 'muse-texinfo)
197 (require 'muse-docbook)
198