8 ;; Config file for GNU Emacs. |
8 ;; Config file for GNU Emacs. |
9 ;; |
9 ;; |
10 ;; For load order see README. |
10 ;; For load order see README. |
11 |
11 |
12 ;; ====================================================================== |
12 ;; ====================================================================== |
13 ;; debugging. |
13 ;; emacs debugging. |
14 |
14 |
15 ;; Shut off message buffer by setting nil. |
15 ;; Shut off message buffer by setting nil. |
16 (setq message-log-max 512) |
16 (setq message-log-max 512) |
17 |
17 |
18 ;; Set the debug option to enable a backtrace when a problem occurs. |
18 ;; Set the debug option to enable a backtrace when a problem occurs. |
32 makefile-mode makefile-gmake-mode |
32 makefile-mode makefile-gmake-mode |
33 ) |
33 ) |
34 "List of development modes.") |
34 "List of development modes.") |
35 |
35 |
36 (defvar my-devel-mode-hook-list |
36 (defvar my-devel-mode-hook-list |
37 '(sh-mode-hook script-mode-hook java-mode-hook c-mode-hook |
37 '( |
38 makefile-mode-hook makefile-gmake-mode-hook python-mode-hook |
38 outline-mode-hook |
39 lisp-mode-hook emacs-lisp-mode-hook) |
39 sh-mode-hook script-mode-hook |
|
40 c-mode-hook c++-mode-hook java-mode-hook |
|
41 python-mode-hook |
|
42 makefile-mode-hook makefile-gmake-mode-hook |
|
43 lisp-mode-hook emacs-lisp-mode-hook) |
40 "List of development mode hooks.") |
44 "List of development mode hooks.") |
41 |
45 |
42 (defvar my-scroll-margin-mode-hook-list |
46 (defvar my-scroll-margin-mode-hook-list |
43 '( |
47 '( |
44 vc-dir-mode-hook |
48 vc-dir-mode-hook |
85 (add-to-list 'initial-frame-alist (cons 'height ty)) |
89 (add-to-list 'initial-frame-alist (cons 'height ty)) |
86 ) ) |
90 ) ) |
87 |
91 |
88 (menu-bar-mode -1) |
92 (menu-bar-mode -1) |
89 (tool-bar-mode -1) |
93 (tool-bar-mode -1) |
90 (when (>= emacs-major-version 22) (tooltip-mode -1)) |
94 (when window-system |
91 (scroll-bar-mode 1) |
95 (defun my-popup-menu () |
|
96 (interactive) |
|
97 (popup-menu |
|
98 (mouse-menu-bar-map) ;; (mouse-menu-major-mode-map) |
|
99 (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name))))) |
|
100 (global-set-key [f10] 'my-popup-menu) |
|
101 (global-set-key [apps] 'my-popup-menu) |
|
102 (when (>= emacs-major-version 22) (tooltip-mode -1)) |
|
103 (scroll-bar-mode 1) |
|
104 ) |
92 |
105 |
93 (setq frame-title-format "Emacs - %b") |
106 (setq frame-title-format "Emacs - %b") |
94 |
107 |
95 (setq default-header-line-format nil) |
108 (setq default-header-line-format nil) |
96 ;; (setq default-mode-line-format nil) |
109 ;; (setq default-mode-line-format nil) |
105 (setq default-truncate-lines nil) |
118 (setq default-truncate-lines nil) |
106 |
119 |
107 ;; show column & line numbers in status bar |
120 ;; show column & line numbers in status bar |
108 (setq column-number-mode t) |
121 (setq column-number-mode t) |
109 (setq line-number-mode t) |
122 (setq line-number-mode t) |
|
123 (setq size-indication-mode t) |
110 |
124 |
111 ;; Also useful such format: (setq display-time-format " %H:%M %d-%m-%y ") |
125 ;; Also useful such format: (setq display-time-format " %H:%M %d-%m-%y ") |
112 (setq display-time-24hr-format t) |
126 (setq display-time-24hr-format t) |
113 (setq display-time-default-load-average nil) |
127 (setq display-time-default-load-average nil) |
114 (display-time) ; display-time-mode |
128 (display-time) ; display-time-mode |
208 (put 'upcase-region 'disabled nil) |
222 (put 'upcase-region 'disabled nil) |
209 (put 'narrow-to-page 'disabled nil) |
223 (put 'narrow-to-page 'disabled nil) |
210 (put 'narrow-to-region 'disabled nil) |
224 (put 'narrow-to-region 'disabled nil) |
211 (put 'scroll-left 'disabled nil) |
225 (put 'scroll-left 'disabled nil) |
212 |
226 |
|
227 (setq |
|
228 use-dialog-box t |
|
229 x-gtk-show-hidden-files t |
|
230 ) |
|
231 |
213 ;; ---------------------------------------------------------------------- |
232 ;; ---------------------------------------------------------------------- |
214 ;; switching, creating, selecting buffers. |
233 ;; switching, creating, selecting buffers. |
215 |
234 |
216 (iswitchb-mode 1) |
235 (iswitchb-mode 1) |
217 (setq iswitchb-buffer-ignore nil) |
236 (setq iswitchb-buffer-ignore nil) |
248 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin)))) |
267 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin)))) |
249 ;; TODO its good invoke delete-dups for list, but delete-dups not exist in Emacs 21.4 |
268 ;; TODO its good invoke delete-dups for list, but delete-dups not exist in Emacs 21.4 |
250 (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) ) |
269 (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) ) |
251 |
270 |
252 ;; ---------------------------------------------------------------------- |
271 ;; ---------------------------------------------------------------------- |
253 ;; searching. |
272 ;; search, isearch, occur. |
254 |
273 |
255 (setq case-fold-search t) |
274 (setq case-fold-search t) |
256 |
275 |
257 (setq query-replace-highlight t) ; highlight during query |
276 (setq query-replace-highlight t) ; highlight during query |
258 (setq search-highlight t) ; highlight incremental search |
277 (setq search-highlight t) ; highlight incremental search |
259 |
|
260 ;; ---------------------------------------------------------------------- |
|
261 ;; *Occur* |
|
262 (global-set-key [f7] 'occur) ; Key binding as in mc |
|
263 |
278 |
264 ;; ---------------------------------------------------------------------- |
279 ;; ---------------------------------------------------------------------- |
265 ;; grep, find. |
280 ;; grep, find. |
266 |
281 |
267 ;; Assume that we have GNU grep, so -H available. |
282 ;; Assume that we have GNU grep, so -H available. |
329 (setq default-input-method 'russian-computer) |
344 (setq default-input-method 'russian-computer) |
330 (setq default-input-method 'cyrillic-jcuken)) |
345 (setq default-input-method 'cyrillic-jcuken)) |
331 ;; (pc-bindings-mode) ; Myself define keybinding, see |
346 ;; (pc-bindings-mode) ; Myself define keybinding, see |
332 |
347 |
333 ;; ---------------------------------------------------------------------- |
348 ;; ---------------------------------------------------------------------- |
334 ;; completition. |
349 ;; completion. |
335 |
350 |
336 ;; partial-completion-mode cause bug in read-file-name with Emacs v22.3.1 (but not with v23.1). |
351 ;; I remove partial-completion-mode because it depricated in Emacs 24.0. |
337 ;; read-file-name used in rgrep, so I disable partial-completion-mode. |
352 ;; Completion controled by 'completion-styles' variable. |
338 (partial-completion-mode -1) ; For example, M-x p-c-m expands to M-x partial-completion-mode |
|
339 |
353 |
340 ;; ---------------------------------------------------------------------- |
354 ;; ---------------------------------------------------------------------- |
341 ;; mouse. |
355 ;; mouse. |
342 |
356 |
343 ;; Scroll Bar gets dragged by mouse butn 1 |
357 ;; Scroll Bar gets dragged by mouse butn 1 |
344 (global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag) |
358 (global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag) |
345 ;; Paste at point NOT at cursor |
359 ;; Paste at point NOT at cursor |
346 (setq mouse-yank-at-point t) |
360 (setq mouse-yank-at-point t) |
347 (mouse-wheel-mode 1) |
361 (when window-system |
|
362 (mouse-wheel-mode 1) |
|
363 ) |
348 |
364 |
349 ;; ---------------------------------------------------------------------- |
365 ;; ---------------------------------------------------------------------- |
350 ;; key binding, short-keys. |
366 ;; key binding, short-keys. |
351 |
367 |
352 (global-set-key [home] 'beginning-of-line) |
368 (global-set-key [home] 'beginning-of-line) |
378 (global-set-key (kbd "C-x d") 'find-file) |
394 (global-set-key (kbd "C-x d") 'find-file) |
379 |
395 |
380 (global-set-key (kbd "\e\eg") 'goto-line) |
396 (global-set-key (kbd "\e\eg") 'goto-line) |
381 (global-set-key (kbd "\e\er") 'query-replace-regexp) |
397 (global-set-key (kbd "\e\er") 'query-replace-regexp) |
382 |
398 |
383 ;; Disable C-z, it ugly. |
399 ;; Disable suspend. It ugly. |
384 (if window-system (global-set-key (kbd "C-z") 'nil)) |
400 (if window-system (global-set-key (kbd "C-z") nil)) |
|
401 (global-set-key (kbd "C-x C-z") nil) |
385 |
402 |
386 ;; (global-set-key [language-change] 'ignore) |
403 ;; (global-set-key [language-change] 'ignore) |
387 |
404 |
388 ;; ====================================================================== |
405 ;; ====================================================================== |
389 ;; coding system, charset, locale, lang. |
406 ;; coding system, charset, locale, lang. |
639 ;; ====================================================================== |
656 ;; ====================================================================== |
640 ;; man, woman. |
657 ;; man, woman. |
641 |
658 |
642 (setq woman-use-own-frame nil) |
659 (setq woman-use-own-frame nil) |
643 (setq woman-fill-frame t) |
660 (setq woman-fill-frame t) |
|
661 |
|
662 ;; ---------------------------------------------------------------------- |
|
663 ;; comint |
|
664 |
|
665 ;; If non-nil, add a `/' to completed directories, ` ' to file names. |
|
666 (setq comint-completion-addsuffix t) |
|
667 ;; Non-nil means go to the end of the line before sending input. |
|
668 (setq comint-eol-on-send t) |
644 |
669 |
645 ;; ====================================================================== |
670 ;; ====================================================================== |
646 ;; shell, sh, bash. |
671 ;; shell, sh, bash. |
647 |
672 |
648 ;; Setup Emacs to run bash as its primary shell. |
673 ;; Setup Emacs to run bash as its primary shell. |
886 |
911 |
887 (mapc (lambda (hook) (add-hook hook (lambda () (setq fill-column my-fill-column)) )) |
912 (mapc (lambda (hook) (add-hook hook (lambda () (setq fill-column my-fill-column)) )) |
888 my-devel-mode-hook-list) |
913 my-devel-mode-hook-list) |
889 |
914 |
890 ;; ---------------------------------------------------------------------- |
915 ;; ---------------------------------------------------------------------- |
891 ;; diff, patch. |
916 ;; diff, patch, ediff, emerge. |
892 |
917 |
893 (setq diff-switches "-u") |
918 (setq diff-switches "-u") |
|
919 |
|
920 (setq ediff-diff-options "") |
894 |
921 |
895 ;; ---------------------------------------------------------------------- |
922 ;; ---------------------------------------------------------------------- |
896 ;; indenting. |
923 ;; indenting. |
897 |
924 |
898 (setq standard-indent 4) |
925 (setq standard-indent 4) |
911 (while (>= i 0) |
938 (while (>= i 0) |
912 (setq tab-stop-list (cons i tab-stop-list)) |
939 (setq tab-stop-list (cons i tab-stop-list)) |
913 (setq i (- i 4)))) |
940 (setq i (- i 4)))) |
914 |
941 |
915 ;; ---------------------------------------------------------------------- |
942 ;; ---------------------------------------------------------------------- |
916 ;; diff. |
|
917 |
|
918 (setq ediff-diff-options "") |
|
919 |
|
920 ;; ---------------------------------------------------------------------- |
|
921 ;; *Compile* |
943 ;; *Compile* |
922 |
944 |
923 (setq compile-auto-highlight t |
945 (setq compile-auto-highlight t |
924 compile-command "make ") |
946 compile-command "make ") |
925 ;; compilation window shall scroll down if not 0 |
947 ;; compilation window shall scroll down if not 0 |
931 (add-to-list 'compilation-error-regexp-alist '("^\\( +\\[csc\\] \\|\\)\\(.*\\)(\\([0-9]*\\),\\([0-9]*\\)):" 2 3 4)) |
953 (add-to-list 'compilation-error-regexp-alist '("^\\( +\\[csc\\] \\|\\)\\(.*\\)(\\([0-9]*\\),\\([0-9]*\\)):" 2 3 4)) |
932 (add-to-list 'compilation-error-regexp-alist '("^ *\\(.*\\)(\\([0-9]*\\)) +:" 1 2)) |
954 (add-to-list 'compilation-error-regexp-alist '("^ *\\(.*\\)(\\([0-9]*\\)) +:" 1 2)) |
933 (add-to-list 'compilation-error-regexp-alist '("^\"?\\([^\"]*\\)\"?,\\([0-9]*\\) .*\\[.*\\]: " 1 2)) ; KEIL compiler |
955 (add-to-list 'compilation-error-regexp-alist '("^\"?\\([^\"]*\\)\"?,\\([0-9]*\\) .*\\[.*\\]: " 1 2)) ; KEIL compiler |
934 ;; (add-to-list 'compilation-mode-font-lock-keywords '("\\(/[Oo][Uu][Tt]:[^ ]+\\)" . 1)) |
956 ;; (add-to-list 'compilation-mode-font-lock-keywords '("\\(/[Oo][Uu][Tt]:[^ ]+\\)" . 1)) |
935 ;; (add-to-list 'compilation-mode-font-lock-keywords '("[ ]\\(/F[oe][^ ]+\\)" . 1)) |
957 ;; (add-to-list 'compilation-mode-font-lock-keywords '("[ ]\\(/F[oe][^ ]+\\)" . 1)) |
|
958 |
|
959 ;; ---------------------------------------------------------------------- |
|
960 ;; TAGS, etags, ctags, GNU GLOBAL. |
|
961 |
|
962 (when (featurep 'etags-table) |
|
963 (setq etags-table-search-up-depth 1) |
|
964 ) |
|
965 |
|
966 ;; ---------------------------------------------------------------------- |
|
967 ;; CEDET, semantic. |
|
968 |
|
969 ;; For debug use 'semantic-debug-idle-function' and 'semantic-debug-idle-work-function'. |
|
970 (when (or (and (= emacs-major-version 23) (= emacs-minor-version 2)) |
|
971 (>= emacs-minor-version 24)) |
|
972 (semantic-mode 1) |
|
973 (global-semantic-idle-summary-mode 1) |
|
974 (global-semantic-idle-scheduler-mode 1) |
|
975 (setq semantic-idle-scheduler-idle-time 1) ; 1 sec. |
|
976 (global-semanticdb-minor-mode 1) |
|
977 (global-semantic-decoration-mode 1) |
|
978 (global-semantic-mru-bookmark-mode 1) |
|
979 ;; (global-semantic-idle-completions-mode -1) |
|
980 ;; (global-semantic-stickyfunc-mode 1) |
|
981 ;; (setq semantic-stickyfunc-sticky-classes '(function type variable include package)) |
|
982 |
|
983 ;; (semantic-add-system-include "~/include" 'c++-mode) |
|
984 ;; (semantic-add-system-include "~/include" 'c-mode) |
|
985 ) |
|
986 |
|
987 ;; ---------------------------------------------------------------------- |
|
988 ;; imenu. |
|
989 |
|
990 (require 'imenu) |
|
991 (when window-system |
|
992 (mapc (lambda (hook) |
|
993 (add-hook hook |
|
994 (lambda () |
|
995 (imenu-add-menubar-index) |
|
996 (run-hooks 'menu-bar-update-hook) |
|
997 ) )) |
|
998 my-devel-mode-hook-list) |
|
999 ) |
936 |
1000 |
937 ;; ---------------------------------------------------------------------- |
1001 ;; ---------------------------------------------------------------------- |
938 ;; windows inf files for driver installing |
1002 ;; windows inf files for driver installing |
939 |
1003 |
940 (add-to-list 'auto-mode-alist '("\\.inf\\'" . conf-mode)) |
1004 (add-to-list 'auto-mode-alist '("\\.inf\\'" . conf-mode)) |
1022 (substatement-open . 0) |
1086 (substatement-open . 0) |
1023 )) |
1087 )) |
1024 (c-echo-syntactic-information-p . t)) |
1088 (c-echo-syntactic-information-p . t)) |
1025 "My C Programming Style") |
1089 "My C Programming Style") |
1026 |
1090 |
1027 (add-hook 'c-mode-common-hook |
1091 (add-hook |
1028 (lambda () (c-add-style "my" my-c-style t))) |
1092 'c-mode-common-hook |
1029 (setq c-default-style '((java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my") (other . "my"))) |
1093 '(lambda () |
|
1094 (c-add-style "my" my-c-style t) |
|
1095 ;; If set 'c-default-style' before 'c-add-style' |
|
1096 ;; "Undefined style: my" error occured from 'c-get-style-variables'. |
|
1097 (setq c-default-style |
|
1098 '( |
|
1099 (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my") |
|
1100 (awk-mode . "awk") |
|
1101 (other . "my") |
|
1102 )) |
|
1103 )) |
|
1104 |
1030 |
1105 |
1031 ;; ---------------------------------------------------------------------- |
1106 ;; ---------------------------------------------------------------------- |
1032 ;; bat file, batch, loaded from 'generic-x.el'. |
1107 ;; bat file, batch, loaded from 'generic-x.el'. |
1033 |
1108 |
1034 ;; ---------------------------------------------------------------------- |
1109 ;; ---------------------------------------------------------------------- |
1045 (add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode)) |
1120 (add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode)) |
1046 |
1121 |
1047 ;; ---------------------------------------------------------------------- |
1122 ;; ---------------------------------------------------------------------- |
1048 ;; java. |
1123 ;; java. |
1049 |
1124 |
1050 ;; Update the Emacs load-path to include the path to |
1125 ;; If you want Emacs to defer loading the JDE until you open a Java file, edit |
1051 ;; the JDE and its require packages. This code assumes |
1126 ;; the following line: |
1052 ;; that you have installed the packages in the emacs/site |
1127 |
1053 ;; subdirectory of your home directory. |
1128 ;; (setq defer-loading-jde t) |
1054 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/semantic")) |
|
1055 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/speedbar")) |
|
1056 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/elib-1.0")) |
|
1057 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/eieio")) |
|
1058 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/jde-2.3.5.1/lisp")) |
|
1059 |
|
1060 ;; Load CEDET |
|
1061 ;; (load-file "~/emacs/site/common/cedet.el") |
|
1062 ;; Enabling SEMANTIC minor modes. See semantic/INSTALL for more ideas. |
|
1063 ;; (semantic-load-enable-code-helpers) |
|
1064 |
|
1065 ;; If you want Emacs to defer loading the JDE until you open a |
|
1066 ;; Java file, edit the following line |
|
1067 ;; (setq defer-loading-jde nil) |
|
1068 ;; to read: |
|
1069 ;; |
|
1070 ;; (setq defer-loading-jde t) |
|
1071 ;; |
|
1072 |
|
1073 ;; (if defer-loading-jde |
1129 ;; (if defer-loading-jde |
1074 ;; (progn |
1130 ;; (progn |
1075 ;; (autoload 'jde-mode "jde" "JDE mode." t) |
1131 ;; (autoload 'jde-mode "jde" "JDE mode." t) |
1076 ;; (add-to-list 'auto-mode-alist '("\\.java\\'" . jde-mode)) |
1132 ;; (add-to-list 'auto-mode-alist '("\\.java\\'" . jde-mode)) |
1077 ;; (require 'jde))) |
1133 ;; (require 'jde))) |
1078 |
1134 |
1079 |
|
1080 ;; Sets the basic indentation for Java source files |
|
1081 ;; to two spaces. |
|
1082 ;; (defun my-jde-mode-hook () |
|
1083 ;; (setq c-basic-offset 2)) |
|
1084 |
|
1085 ;; (add-hook 'jde-mode-hook 'my-jde-mode-hook) |
|
1086 |
|
1087 ;; (require 'jde) |
|
1088 |
|
1089 ;; ---------------------------------------------------------------------- |
1135 ;; ---------------------------------------------------------------------- |
1090 ;; ECB. |
1136 ;; ECB. |
1091 |
1137 |
1092 (setq ecb-tip-of-the-day nil) |
1138 (setq ecb-tip-of-the-day nil) |
1093 ;; (add-to-list 'load-path "~/emacs/site/ecb-2.32") |
|
1094 ;; (require 'ecb) |
|
1095 |
|
1096 ;; (global-set-key (kbd "\e\eE") 'ecb-activate) |
|
1097 |
1139 |
1098 ;; ---------------------------------------------------------------------- |
1140 ;; ---------------------------------------------------------------------- |
1099 ;; html. |
1141 ;; html. |
1100 |
1142 |
1101 ;; ---------------------------------------------------------------------- |
1143 ;; ---------------------------------------------------------------------- |
1103 |
1145 |
1104 ;; ---------------------------------------------------------------------- |
1146 ;; ---------------------------------------------------------------------- |
1105 ;; psgml. |
1147 ;; psgml. |
1106 |
1148 |
1107 (setq sgml-set-face t) ; for highlighting in sgml |
1149 (setq sgml-set-face t) ; for highlighting in sgml |
|
1150 |
|
1151 ;; ---------------------------------------------------------------------- |
|
1152 ;; sh, bash. |
|
1153 |
|
1154 (add-to-list 'auto-mode-alist '("\\.cygport\\'" . shell-script-mode)) |
1108 |
1155 |
1109 ;; ====================================================================== |
1156 ;; ====================================================================== |
1110 ;; printing. |
1157 ;; printing. |
1111 |
1158 |
1112 ;; Use Notepad to print plain text files to the default Windows printer |
1159 ;; Use Notepad to print plain text files to the default Windows printer |
1154 ;; ====================================================================== |
1201 ;; ====================================================================== |
1155 ;; backuping. |
1202 ;; backuping. |
1156 |
1203 |
1157 (setq |
1204 (setq |
1158 make-backup-files t |
1205 make-backup-files t |
1159 backup-by-copying t ; don't clobber symlinks |
1206 ;; In other case (by renaming) you loose original file creation date. |
|
1207 backup-by-copying t |
1160 backup-directory-alist '(("." . "~/.backup")) ; don't litter my fs tree |
1208 backup-directory-alist '(("." . "~/.backup")) ; don't litter my fs tree |
1161 delete-old-versions t ; delete excess backup versions silently |
1209 delete-old-versions t ; delete excess backup versions silently |
1162 kept-old-versions 1 ; store first original version |
1210 kept-old-versions 1 ; store first original version |
1163 kept-new-versions 3 ; store last 3 version |
1211 kept-new-versions 3 ; store last 3 version |
1164 version-control t) ; use versioned backups |
1212 version-control t) ; use versioned backups |