summaryrefslogtreecommitdiff
path: root/emacs
blob: 96e8f001d3db037cbaaf47d0465177e7d2679e78 (plain)
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
;; add my paths to load-path
(add-to-list 'load-path "~/.emacs.d/session")
(add-to-list 'load-path "~/.emacs.d/lisp")

;; setup fontset
(if window-system
    (progn
      ;; font setting
      (set-frame-font "Bitstream Vera Sans Mono-9")
      (add-to-list 'default-frame-alist '(font . "Bitstream Vera Sans Mono-9"))
      (set-fontset-font (frame-parameter nil 'font)
			'han '("Microsoft YaHei" . "unicode-bmp"))

      ;; Window Positioninga
      (setq default-frame-alist '((top . 0) (left . 0)
				  (width . 156) (height . 38)))))

;; setup show startup message
(setq inhibit-startup-message t)

(require 'site-gentoo)

;;(setq-default make-backup-files nil)

;; load cedet, semantic and ecb
(setq ecb-auto-activate t)
(setq ecb-tip-of-the-day nil)
(setq semantic-load-turn-useful-things-on t)
(require 'cedet)
(require 'ecb)
(semantic-load-enable-code-helpers)
(require 'semantic-ia)
(global-set-key [(control p)] 'semantic-ia-complete-symbol-menu)
(global-semantic-show-unmatched-syntax-mode -1)
(require 'ede)
(global-ede-mode t)

;; c & c++
(semantic-add-system-include "/usr/include" 'c-mode)
(semantic-add-system-include "/usr/include" 'c++-mode)

;; qt4
(setq qt4-base-dir "/usr/include/qt4")
(setq qt4-gui-dir (concat qt4-base-dir "/QtGui"))
(semantic-add-system-include qt4-base-dir 'c++-mode)
(semantic-add-system-include qt4-gui-dir 'c++-mode)
(add-to-list 'auto-mode-alist (cons qt4-base-dir 'c++-mode))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
	     (concat qt4-base-dir "/Qt/qconfig.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
	     (concat qt4-base-dir "/Qt/qconfig-large.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
	     (concat qt4-base-dir "/Qt/qglobal.h"))

;; sexy app framework
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("SEXY_EXPORT" . ""))

;; cairo
(add-to-list 'semantic-lex-c-preprocessor-symbol-map '("cairo_public" . ""))
(setq cairo-basedir "/usr/include/cairo")
(semantic-add-system-include cairo-basedir 'c-mode)
(semantic-add-system-include cairo-basedir 'c++-mode)

;; glib-2.0
(setq glib2-basedir "/usr/include/glib-2.0")
(setq glib2-config "/usr/lib/glib-2.0/include/glibconfig.h")
(add-to-list 'semantic-lex-c-preprocessor-symbol-file glib2-config)
(semantic-add-system-include glib2-basedir 'c-mode)
(semantic-add-system-include glib2-basedir 'c++-mode)

;; pango-1.0
(setq pango-basedir "/usr/include/pango-1.0")
(semantic-add-system-include pango-basedir 'c-mode)
(semantic-add-system-include pango-basedir 'c++-mode)

;; gtk-2.0
(setq gtk2-basedir "/usr/include/gtk-2.0")
(setq gtk2-config "/usr/lib/gtk-2.0/include/gdkconfig.h")
(add-to-list 'semantic-lex-c-preprocessor-symbol-file gtk2-config)
(semantic-add-system-include gtk2-basedir 'c-mode)
(semantic-add-system-include gtk2-basedir 'c++-mode)

;; vala
(autoload 'vala-mode "vala-mode" "Major mode for editing Vala code." t)
(require 'vala-mode)
(add-to-list 'auto-mode-alist '("\\.vala$" . vala-mode))
(add-to-list 'auto-mode-alist '("\\.vapi$" . vala-mode))
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))

;; for ecb
(add-hook 'vala-mode-hook #'wisent-csharp-default-setup)

;; set color theme if emacs is windowed
(require 'color-theme)
(color-theme-initialize)
(if window-system
    (progn
      (color-theme-bharadwaj-slate)))

;;color terminal
(require 'ansi-color)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

;; ask for y or n instead
(fset 'yes-or-no-p 'y-or-n-p)

(transient-mark-mode t)

(add-hook 'find-file-hooks 'auto-insert)

(show-paren-mode t)

;;(setq lazy-lock-defer-on-scrolling t)
;;(setq font-lock-support-mode 'lazy-lock-mode)
;;(setq font-lock-maximum-decoration t)

;; setup keybinds
(global-set-key [f5] 'ecb-activate)
(global-set-key [f6] 'ecb-deactivate)
(global-set-key [f9] 'compile)
(global-set-key [f12] 'gdb)

;;session
(require 'session)
(add-hook 'after-init-hook 'session-initialize)

;; setup tabbar
(require 'tabbar)
(tabbar-mode)
(global-set-key [(s-down)] 'tabbar-backward-group)
(global-set-key [(s-up)] 'tabbar-forward-group)
(global-set-key (kbd "s-b") 'tabbar-backward)
(global-set-key (kbd "s-f") 'tabbar-forward)

;; kill a line
(defun kill-whole-line nil
  "delete the whole line"
  (interactive)
  (beginning-of-line)
  (push-mark)
  (beginning-of-line 2)
  (kill-region (point) (mark)))
(global-set-key "\M-\S-d" 'kill-whole-line)

;; compile .emacs
(defun autocompile nil
  "compile itself if ~/.emacs"
  (interactive)
  (if (string= (buffer-file-name) (concat default-directory ".emacs"))
      (byte-compile-file (buffer-file-name))))
(add-hook 'after-save-hook 'autocompile)

;; setup cc styles
(require 'setup-cc-styles)

;; guess offset
(require 'guess-offset)

;;M-x desktop-clear
;;(load "desktop")
;;(desktop-save-mode)
;;(desktop-read)
;;(global-set-key [f11] 'desktop-save)
(require 'doxymacs)
(add-hook 'c-mode-common-hook 'doxymacs-mode)

;; emacs
(add-to-list 'auto-mode-alist '("emacs/emacs" . lisp-mode))

;; scons
(add-to-list 'auto-mode-alist '("SConstruct" . python-mode))
(add-to-list 'auto-mode-alist '("SConscript" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

;; Set the fill column to 70 for human text, and 80 for code.
;;(add-hook 'text-mode-hook '(lambda () (set-fill-column 70)))
;;(add-hook 'c-mode-hook '(lambda () (set-fill-column 80)))
;;(add-hook 'c++-mode-hook '(lambda () (set-fill-column 80)))
;;(add-hook 'python-mode-hook '(lambda () (set-fill-column 80)))
;;(add-hook 'java-mode-hook '(lambda () (set-fill-column 80)))

;; setup auto-complete-mode
(require 'setup-auto-complete)

;; erc
(require 'setup-erc)

(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.
 '(column-number-mode t)
 '(display-time-mode t)
 '(ecb-options-version "2.40")
 '(ecb-source-path (quote (("~/Projects" "Projects"))))
 '(scroll-bar-mode (quote right))
 '(show-paren-mode t)
 '(show-trailing-whitespace t)
 '(size-indication-mode t)
 '(transient-mark-mode 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.
 )

(put 'narrow-to-region 'disabled nil)