-
Notifications
You must be signed in to change notification settings - Fork 2
/
init-cedet.el
241 lines (211 loc) · 10.9 KB
/
init-cedet.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
;; ----------------------------------------------------------------------
;; File: init-cedet.el - configuration of my CEDET environment
;; Part of my emacs configuration (see ~/.emacs or init.el)
;;
;; Copyright (c) 2010 Sebastien Varrette <[email protected]>
;; http://varrette.gforge.uni.lu
;;
;; _ _ _ _ _ _
;; (_)_ __ (_) |_ ___ ___ __| | ___| |_ ___| |
;; | | '_ \| | __|____ / __/ _ \/ _` |/ _ \ __| / _ \ |
;; | | | | | | ||_____| (_| __/ (_| | __/ |_ | __/ |
;; |_|_| |_|_|\__| \___\___|\__,_|\___|\__(_)___|_|
;;
;;
;; More information about Emacs Lisp:
;; http://www.emacswiki.org/emacs/EmacsLisp
;; ----------------------------------------------------------------------
;; This file is NOT part of GNU Emacs.
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; ----------------------------------------------------------------------
;; ================================================
;; === Integrated Development Environment (IDE) ===
;; ================================================
;; Mainly rely on Collection Of Emacs Development Environment Tools (CEDET)
;; see http://cedet.sourceforge.net/
;; Nice intro to CEDET:
;; http://xtalk.msk.su/~ott/en/writings/emacs-devenv/EmacsCedet.html
(require 'cedet)
;; ----------------
;; === Semantic ===
;; ----------------
;; see http://cedet.sourceforge.net/semantic.shtml
;; The most critical part as it is the code parser that will latter provide text
;; analysis in Emacs
;; Depending on your requirements, you can use one of the commands, described
;; below, to load corresponding set of features (these commands are listed in
;; increasing order, and each command include features of previous commands):
;;
;; o This is the default. Enables the database and idle reparse
;; engines
;;(semantic-load-enable-minimum-features)
;; o This enables some tools useful for coding, such as summary mode imenu
;; support, the semantic navigator i.e prototype help and smart completion
(semantic-load-enable-code-helpers)
;; o This enables even more coding tools such as the nascent
;; intellisense mode decoration mode, and stickyfunc mode (plus
;; regular code helpers)
;;(semantic-load-enable-guady-code-helpers)
;; o This turns on which-func support (plus all other code
;; helpers)
;;(semantic-load-enable-excessive-code-helpers)
;; o This turns on modes that aid in writing grammar and developing
;; semantic tool.
;; It does not enable any other features such as code helpers above.
;;(semantic-load-enable-semantic-debugging-helpers)
;; Directory that semantic use to cache its files
(setq semanticdb-default-save-directory "~/.emacs.d/.emacs-semanticdb") ; getting rid of semantic.caches
(require 'semantic-ia)
;; Add a new menu called "TAGS" that provides... Guess it;)
(defun my-semantic-hook ()
(imenu-add-to-menubar "TAGS"))
(add-hook 'semantic-init-hooks 'my-semantic-hook)
;; -----------------------------
;; === Prepare CEDET binding ===
(defun my-cedet-hook ()
;; Intellisense menu
(local-set-key (read-kbd-macro "C-<return>") 'semantic-ia-complete-symbol-menu)
;; jump to declaration of variable or function, whose name is under point
(local-set-key "\C-cj" 'semantic-ia-fast-jump)
(local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle) ; swith to/from declaration/implement
;;
(local-set-key "\C-ch" 'semantic-decoration-include-visit) ; visit the header file under point
;;
;; shows documentation for function or variable, whose names is under point
(local-set-key "\C-cd" 'semantic-ia-show-doc) ; in a separate buffer
(local-set-key "\C-cs" 'semantic-ia-show-summary) ; in the mini-buffer
)
(add-hook 'c-mode-common-hook 'my-cedet-hook)
(add-hook 'lisp-mode-hook 'my-cedet-hook)
(add-hook 'scheme-mode-hook 'my-cedet-hook)
(add-hook 'emacs-lisp-mode-hook 'my-cedet-hook)
;; ;; === EAssist (Emacs Assist) ===
;; see http://www.emacswiki.org/emacs/EAssist
(require 'eassist)
;; mainly provides the following methods:
;; * eassist-switch-h-cpp: switch from header to body file and backwards (for
;; C++ only)
;; * eassist-list-methods: produce method/function list
(defun my-c-mode-common-hook ()
(define-key c-mode-base-map (kbd "\C-xz") 'eassist-switch-h-cpp)
(define-key c-mode-base-map (kbd "M-m") 'eassist-list-methods))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;; --------------------------------
;; === ECB (Emacs Code Browser) ===
;; see http://ecb.sourceforge.net/
;; or http://www.emacswiki.org/emacs/EmacsCodeBrowser
;; or http://www.emacswiki.org/emacs/PracticalECB
(require 'ecb)
(require 'ecb-autoloads)
;; /!\ Caution on ECB variable configuration
;; see http://ecb.sourceforge.net/docs/setq-or-customize.html#setq-or-customize
;; for the options that shouldn't be configured via setq ;(
;; --- ECB layout
(setq ecb-create-layout-file "~/.emacs.d/.ecb-user-layout.el") ; where my layout are saved
(setq ecb-windows-width 35)
;; create a simple special layout "falkor1"
;; +------+-------+--------------------------------------+
;; | | |
;; | | |
;; | Directories | |
;; | | Edit |
;; | | |
;; +------+-------+ |
;; | History | |
;; | | |
;; +-----------------------------------------------------+
(ecb-layout-define "falkor1" left nil
;; The frame is already splitted side-by-side and point stays in the
;; left window (= the ECB-tree-window-column)
;; Here is the creation code for the new layout
;; 1. Defining the current window/buffer as ECB-methods buffer
(ecb-set-directories-buffer)
;; 2. Splitting the ECB-tree-windows-column in two windows
(ecb-split-ver 0.75 t)
;; 3. Go to the second window
(other-window 1)
;; 4. Defining the current window/buffer as ECB-history buffer
(ecb-set-history-buffer)
;; 5. Make the ECB-edit-window current (see Postcondition above)
(select-window (next-window)))
;; create another simple special layout "falkor2"
;; +------+-------+--------------------------------------+
;; | | |
;; | Directories | |
;; | | |
;; +------+-------+ |
;; | History | Edit |
;; +------+-------+ |
;; | Methods | |
;; | | |
;; +-----------------------------------------------------+
(ecb-layout-define "falkor2" left nil
;; The frame is already splitted side-by-side and point stays in the
;; left window (= the ECB-tree-window-column)
;; Here is the creation code for the new layout
;; 1. Defining the current window/buffer as ECB-methods buffer
(ecb-set-directories-buffer)
;; 2. Splitting the ECB-tree-windows-column in two windows
(ecb-split-ver 0.5 t)
;; 3. Go to the second window
(other-window 1)
;; 4. Defining the current window/buffer as ECB-history buffer
(ecb-set-history-buffer)
;; 5. Splitting the ECB-tree-windows-column in two windows
(ecb-split-ver 0.25 t)
;; 6. Go to the third window
(other-window 1)
;; 7. Defining the current window/buffer as ECB-y buffer
(ecb-set-methods-buffer)
;; 8. Make the ECB-edit-window current (see Postcondition above)
(select-window (next-window)))
;;(setq ecb-show-sources-in-directories-buffer "falkor1")
(setq ecb-show-sources-in-directories-buffer "falkor2")
;; see http://ecb.sourceforge.net/docs/Changing-the-ECB-layout.html for default
;; layout alternatives.
;; My personnal ECB layout (falkor), is as follows:
;; +------+-------+--------------------------------------+
;; | | | |
;; | Dir | Src | |
;; | | | |
;; | | | |
;; +------+-------+ |
;; | History | Edit |
;; | | |
;; +--------------+ |
;; | | |
;; | Methods | |
;; | | |
;; | | |
;; +-----------------------------------------------------+
;; You can easily create your own layout using M-x ecv-create-new-layout
;; see ~/emacs.d/custom.el for the configuration of my own layout
(setq ecb-history-sort-method nil) ; No sorting, means the most recently used
; buffers are on the top of the history
; and the seldom used buffers at the bottom
(setq ecb-vc-enable-support t) ; show versionning status of the files
; in the sources/hstory (SVN etc.)
;; autostart ECB on emacs startup (put to nil to desactivate)
(setq ecb-auto-activate t)
;; --- Annoyances
;; use the primary button to navigate in the source tree -- middle button otherwise (!?!)
(setq ecb-tip-of-the-day nil) ; disable tips of the day
(provide 'init-cedet)
;; ----------------------------------------------------------------------
;; eof
;;
;; Local Variables:
;; mode: lisp
;; End: