Skip to content
Newer
Older
100644 211 lines (177 sloc) 7.78 KB
a674837 @alexott update configs
authored May 8, 2009
1 ;;; emacs-rc-cedet.el ---
2
0fbb20b @alexott switch to new CEDET
authored Apr 28, 2012
3 (load-file "~/projects/cedet-git/cedet-devel-load.el")
4 (add-to-list 'load-path "~/projects/cedet-git/contrib/")
5 (add-to-list 'Info-directory-list "~/projects/cedet-git/doc/info")
6
7 ;;(add-to-list 'semantic-default-submodes 'global-semantic-idle-summary-mode)
8 (add-to-list 'semantic-default-submodes 'global-semantic-mru-bookmark-mode)
9 (add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode)
10 (add-to-list 'semantic-default-submodes 'global-semantic-idle-scheduler-mode)
e8ece07 @alexott more config's optimizations
authored May 1, 2012
11 ;(add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
0fbb20b @alexott switch to new CEDET
authored Apr 28, 2012
12 (add-to-list 'semantic-default-submodes 'global-cedet-m3-minor-mode)
13 (add-to-list 'semantic-default-submodes 'global-semantic-highlight-func-mode)
14 ;;(add-to-list 'semantic-default-submodes 'global-semantic-show-unmatched-syntax-mode)
15 ;;(add-to-list 'semantic-default-submodes 'global-semantic-highlight-edits-mode)
16 ;;(add-to-list 'semantic-default-submodes 'global-semantic-show-parser-state-mode)
17 ;;(add-to-list 'semantic-default-submodes ')
18
19 ;; Activate semantic
20 (semantic-mode 1)
21
22 (require 'semantic/bovine/c)
23 (require 'semantic/bovine/gcc)
24 (require 'semantic/bovine/clang)
25 (require 'semantic/ia)
26 (require 'semantic/decorate/include)
27 (require 'semantic/lex-spp)
a674837 @alexott update configs
authored May 8, 2009
28 (require 'eassist)
29
30 ;; customisation of modes
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
31 (defun alexott/cedet-hook ()
a674837 @alexott update configs
authored May 8, 2009
32 (local-set-key "\C-c?" 'semantic-ia-complete-symbol)
33 ;;
34 (local-set-key "\C-c>" 'semantic-complete-analyze-inline)
35 (local-set-key "\C-c=" 'semantic-decoration-include-visit)
36
37 (local-set-key "\C-cj" 'semantic-ia-fast-jump)
38 (local-set-key "\C-cq" 'semantic-ia-show-doc)
39 (local-set-key "\C-cs" 'semantic-ia-show-summary)
40 (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle)
0fbb20b @alexott switch to new CEDET
authored Apr 28, 2012
41 (local-set-key (kbd "C-c <left>") 'semantic-tag-folding-fold-block)
42 (local-set-key (kbd "C-c <right>") 'semantic-tag-folding-show-block)
e8ece07 @alexott more config's optimizations
authored May 1, 2012
43
44 (add-to-list 'ac-sources 'ac-source-semantic)
a674837 @alexott update configs
authored May 8, 2009
45 )
0efeedb @alexott update configs to latest version
authored Jul 2, 2009
46 ;; (add-hook 'semantic-init-hooks 'alexott/cedet-hook)
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
47 (add-hook 'c-mode-common-hook 'alexott/cedet-hook)
48 (add-hook 'lisp-mode-hook 'alexott/cedet-hook)
0020615 @alexott update configs
authored Oct 20, 2009
49 (add-hook 'scheme-mode-hook 'alexott/cedet-hook)
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
50 (add-hook 'emacs-lisp-mode-hook 'alexott/cedet-hook)
0efeedb @alexott update configs to latest version
authored Jul 2, 2009
51 (add-hook 'erlang-mode-hook 'alexott/cedet-hook)
a674837 @alexott update configs
authored May 8, 2009
52
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
53 (defun alexott/c-mode-cedet-hook ()
a674837 @alexott update configs
authored May 8, 2009
54 ;; (local-set-key "." 'semantic-complete-self-insert)
55 ;; (local-set-key ">" 'semantic-complete-self-insert)
56 (local-set-key "\C-ct" 'eassist-switch-h-cpp)
57 (local-set-key "\C-xt" 'eassist-switch-h-cpp)
58 (local-set-key "\C-ce" 'eassist-list-methods)
59 (local-set-key "\C-c\C-r" 'semantic-symref)
e8ece07 @alexott more config's optimizations
authored May 1, 2012
60
61 (add-to-list 'ac-sources 'ac-source-etags)
a674837 @alexott update configs
authored May 8, 2009
62 )
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
63 (add-hook 'c-mode-common-hook 'alexott/c-mode-cedet-hook)
a674837 @alexott update configs
authored May 8, 2009
64
e8ece07 @alexott more config's optimizations
authored May 1, 2012
65 (semanticdb-enable-gnu-global-databases 'c-mode t)
66 (semanticdb-enable-gnu-global-databases 'c++-mode t)
a674837 @alexott update configs
authored May 8, 2009
67
e8ece07 @alexott more config's optimizations
authored May 1, 2012
68 (when (cedet-ectag-version-check t)
69 (semantic-load-enable-primary-ectags-support))
0fbb20b @alexott switch to new CEDET
authored Apr 28, 2012
70
71 ;; SRecode
72 (global-srecode-minor-mode 1)
73
74 ;; EDE
75 (global-ede-mode 1)
76 (ede-enable-generic-projects)
a674837 @alexott update configs
authored May 8, 2009
77
f79a920 @alexott update configs
authored Dec 7, 2010
78 (defun recur-list-files (dir re)
79 "Returns list of files in directory matching to given regex"
80 (when (file-accessible-directory-p dir)
81 (let ((files (directory-files dir t))
82 matched)
83 (dolist (file files matched)
84 (let ((fname (file-name-nondirectory file)))
85 (cond
86 ((or (string= fname ".")
87 (string= fname "..")) nil)
88 ((and (file-regular-p file)
89 (string-match re fname))
90 (setq matched (cons file matched)))
91 ((file-directory-p file)
92 (let ((tfiles (recur-list-files file re)))
93 (when tfiles (setq matched (append matched tfiles)))))))))))
94
95 (defun c++-setup-boost (boost-root)
96 (when (file-accessible-directory-p boost-root)
97 (let ((cfiles (recur-list-files boost-root "\\(config\\|user\\)\\.hpp")))
98 (dolist (file cfiles)
99 (add-to-list 'semantic-lex-c-preprocessor-symbol-file file)))))
0020615 @alexott update configs
authored Oct 20, 2009
100
a674837 @alexott update configs
authored May 8, 2009
101
102
103 ;; my functions for EDE
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
104 (defun alexott/ede-get-local-var (fname var)
a674837 @alexott update configs
authored May 8, 2009
105 "fetch given variable var from :local-variables of project of file fname"
106 (let* ((current-dir (file-name-directory fname))
107 (prj (ede-current-project current-dir)))
108 (when prj
109 (let* ((ov (oref prj local-variables))
110 (lst (assoc var ov)))
111 (when lst
112 (cdr lst))))))
113
114 ;; setup compile package
115 (require 'compile)
116 (setq compilation-disable-input nil)
117 (setq compilation-scroll-output t)
118 (setq mode-compile-always-save-buffer-p t)
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
119
120 (defun alexott/compile ()
a674837 @alexott update configs
authored May 8, 2009
121 "Saves all unsaved buffers, and runs 'compile'."
122 (interactive)
123 (save-some-buffers t)
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
124 (let* ((r (alexott/ede-get-local-var
a674837 @alexott update configs
authored May 8, 2009
125 (or (buffer-file-name (current-buffer)) default-directory)
126 'compile-command))
127 (cmd (if (functionp r) (funcall r) r)))
128 (set (make-local-variable 'compile-command) (or cmd compile-command))
129 (compile compile-command)))
130
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
131 (global-set-key [f9] 'alexott/compile)
a674837 @alexott update configs
authored May 8, 2009
132
133 ;;
0020615 @alexott update configs
authored Oct 20, 2009
134 (defun alexott/gen-std-compile-string ()
135 "Generates compile string for compiling CMake project in debug mode"
136 (let* ((current-dir (file-name-directory
137 (or (buffer-file-name (current-buffer)) default-directory)))
138 (prj (ede-current-project current-dir))
0fbb20b @alexott switch to new CEDET
authored Apr 28, 2012
139 (root-dir (ede-project-root-directory prj)))
0020615 @alexott update configs
authored Oct 20, 2009
140 (concat "cd " root-dir "; make -j2")))
141
142 ;;
36ce5dd @alexott refactoring of init file
authored Jun 24, 2009
143 (defun alexott/gen-cmake-debug-compile-string ()
a674837 @alexott update configs
authored May 8, 2009
144 "Generates compile string for compiling CMake project in debug mode"
145 (let* ((current-dir (file-name-directory
146 (or (buffer-file-name (current-buffer)) default-directory)))
147 (prj (ede-current-project current-dir))
148 (root-dir (ede-project-root-directory prj))
149 (subdir "")
150 )
151 (when (string-match root-dir current-dir)
152 (setf subdir (substring current-dir (match-end 0))))
f79a920 @alexott update configs
authored Dec 7, 2010
153 (concat "cd " root-dir "Debug/" "; make -j3")))
a674837 @alexott update configs
authored May 8, 2009
154
0fbb20b @alexott switch to new CEDET
authored Apr 28, 2012
155 (defun alexott/gen-cmake-debug/release-compile-string ()
156 "Generates compile string for compiling CMake project in debug & release modes"
157 (let* ((current-dir (file-name-directory
158 (or (buffer-file-name (current-buffer)) default-directory)))
159 (prj (ede-current-project current-dir))
160 (root-dir (ede-project-root-directory prj))
161 (subdir "")
162 )
163 (when (string-match root-dir current-dir)
164 (setf subdir (substring current-dir (match-end 0))))
165 (concat "cd " root-dir "Debug/ && make -j3 && cd " root-dir "Release/ && make -j3" )))
166
167 ;; Projects
168
169 ;; cpp-tests project definition
170 (when (file-exists-p "~/projects/lang-exp/cpp/CMakeLists.txt")
171 (setq cpp-tests-project
172 (ede-cpp-root-project "cpp-tests"
173 :file "~/projects/lang-exp/cpp/CMakeLists.txt"
174 :system-include-path '("/home/ott/exp/include"
175 boost-base-directory)
176 :local-variables (list
177 (cons 'compile-command 'alexott/gen-cmake-debug-compile-string)
178 )
179 )))
180
181 (when (file-exists-p "~/projects/squid-gsb/README")
182 (setq squid-gsb-project
183 (ede-cpp-root-project "squid-gsb"
184 :file "~/projects/squid-gsb/README"
185 :system-include-path '("/home/ott/exp/include"
186 boost-base-directory)
187 :local-variables (list
188 (cons 'compile-command 'alexott/gen-cmake-debug-compile-string)
189 )
190 )))
191
192 ;; (when (file-exists-p "~/work/emacs-head/README")
193 ;; (setq emacs-project
194 ;; (ede-emacs-project "emacs-head"
195 ;; :file "~/work/emacs-head/README")))
196
197
198 ;; (setq arabica-project
199 ;; (ede-cpp-root-project "arabica"
200 ;; :file "~/projects/arabica-devel/README"
201 ;; :system-include-path '("/home/ott/exp/include"
202 ;; boost-base-directory)
203 ;; :local-variables (list
204 ;; (cons 'compile-command 'alexott/gen-std-compile-string)
205 ;; )
206 ;; ))
207
93ab8d7 @alexott update configs, remove standard snippets (leave only mine)
authored Feb 29, 2012
208
a674837 @alexott update configs
authored May 8, 2009
209 ;;; emacs-rc-cedet.el ends here
210
Something went wrong with that request. Please try again.