;; 标题栏,显示"buffer的名字@Emacs"
(setq frame-title-format;设置标题栏显示文件的完整路径名
'("%S" (buffer-file-name "%f"
(dired-directory dired-directory "%b"))))
;; 禁用启动信息
(setq inhibit-startup-message t)
;; 显示光标位置
(setq column-number-mode t)
(setq line-number-mode t)
;; 显示行号
(load-file "C:/emacs/emacs-22.3/site-lisp/linum.el")
(require 'linum)
(global-linum-mode t)
;;左移4个字符
(global-set-key [(backtab)] 'decrease-left-margin)
;;右移4个字符
(global-set-key [(control ?.)] 'increase-left-margin)
;;窗口宽度扩大
(global-set-key [(control left)] 'enlarge-window-horizontally)
(global-set-key [(control right)] 'shrink-window-horizontally)
(global-set-key [(control up)] 'enlarge-window)
(global-set-key [(control down)] 'shrink-window)
;;;F3:切换到dired模式
(global-set-key [(f3)] 'dired)
;;;F4:切换到shell模式
(global-set-key [(f4)] 'shell)
'(compile-command "make")
(setq tab-width 4 indent-tabs-mode nil)
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
(defun my-c-mode-common-hook()
(setq c-tab-always-indent nil)
(setq c-basic-offset 4)
;;; hungry-delete and auto-newline
(c-toggle-auto-hungry-state 1)
;;按键定义
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f7)] 'compile)
(define-key c-mode-base-map [(meta /`)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
(local-set-key [(control return)] 'semantic-ia-complete-symbol)
(local-set-key "." 'semantic-complete-self-insert)
(local-set-key ">" 'semantic-complete-self-insert)
(local-set-key [(f2)] 'semantic-ia-show-doc)
;;预处理设置
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq hs-minor-mode t)
(setq abbrev-mode t)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(load-file "C:/emacs/emacs-22.3/site-lisp/cedet/common/cedet.el")
(load-file "C:/emacs/emacs-22.3/site-lisp/xcscope.el")
(load-file "C:/emacs/emacs-22.3/site-lisp/ecb-2.40/ecb.el")
(require 'xcscope)
(require 'ecb)
(setq semanticdb-project-roots
(list
(expand-file-name "/")))
(defun my-indent-or-complete ()
(interactive)
(if (looking-at "//>")
(hippie-expand nil)
(indent-for-tab-command)) )
(autoload 'senator-try-expand-semantic "senator")
(setq hippie-expand-try-functions-list
'(
senator-try-expand-semantic
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-expand-list
try-expand-list-all-buffers
try-expand-line
try-expand-line-all-buffers
try-complete-file-name-partially
try-complete-file-name
try-expand-whole-kill
)
)
(defun my-semantic-hook ()
(imenu-add-to-menubar "TAGS"))
(add-hook 'semantic-init-hooks 'my-semantic-hook)
(semantic-load-enable-excessive-code-helpers)
(require 'semantic-ia)
(require 'semantic-gcc)
(setq-mode-local c-mode semanticdb-find-default-throttle '(project unloaded system recursive))
(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.
'(ecb-options-version "2.40")
'(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
'(semantic-c-dependency-system-include-path (quote ("c://cygwin//usr//include"))))
(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.
)