;(require 'color-theme)
;(color-theme-initialize)
;(color-theme-tty-dark)
;(color-theme-comidia)
;(color-theme-dark-laptop)
;;;; 顯示行號(hào):
(require 'linum)
(global-linum-mode t)
(column-number-mode t)
(setq column-number-mode t)
(setq line-number-mode t)
(set-face-background 'default "black")
(set-face-foreground 'default "wheat")
(set-cursor-color "white")
;;;; 顯示時(shí)間
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)
;;;; 關(guān)閉啟動(dòng)畫面
(setq inhibit-startup-message t)
;;;;設(shè)置大的kill ring
(setq kill-ring-max 150)
(require 'xcscope)
;;;;備份策略
(setq backup-directory-alist '(("" . "~/backup/emacs/backup")))
(setq-default make-backup-file t)
(setq make-backup-file t)
(setq make-backup-files t)
(setq version-control t)
(setq kept-old-versions 2)
(setq kept-new-versions 10)
(setq delete-old-versions t)
;;;;C/C++語(yǔ)言啟動(dòng)時(shí)自動(dòng)加載semantic對(duì)/usr/include的索引數(shù)據(jù)庫(kù)
(setq semanticdb-search-system-databases t)
(add-hook 'c-mode-common-hook
(lambda ()
(setq semanticdb-project-system-databases
(list (semanticdb-create-database
semanticdb-new-database-class
"/usr/include")))))
;; project root path
(setq semanticdb-project-roots
(list
(expand-file-name "/")))
;; 避免semantic占用CPU過(guò)多
(setq-default semantic-idle-scheduler-idle-time 432000)
(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 linux-c-mode ()
"C mode with adjusted defaults for use with the Linux kernel."
(interactive)
(c-mode)
(c-set-style "K&R")
(setq tab-width 8)
(setq indent-tabs-mode t)
(setq c-basic-offset 8))
;; c-mode公共設(shè)置
(defun my-c-mode-common-hook ()
(interactive)
;(c-mode)
;(c-set-style "K&R")
(setq tab-width 8)
(setq indent-tabs-mode t)
(setq c-basic-offset 8)
(hs-minor-mode t)
;;; hungry-delete and auto-newline
;;(c-toggle-auto-hungry-state 1)
;;按鍵定義
(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f7)] 'compile)
(define-key c-mode-base-map [(f8)] 'ff-get-other-file)
(define-key c-mode-base-map [(f5)] 'gud-go)
(define-key c-mode-base-map [(f10)] 'gud-next)
(define-key c-mode-base-map [(f11)] 'gud-step)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;; (define-key c-mode-base-map [(tab)] 'hippie-expand)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;;預(yù)處理設(shè)置
(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)
;; C 語(yǔ)言設(shè)置
(defun my-c-mode-hook ()
(c-set-style "cc-mode"))
(add-hook 'c-mode-hook 'my-c-mode-hook)
;; C++設(shè)置
(defun my-c++-mode-hook ()
(c-set-style "stroustrup"))
(add-hook 'c++-mode-hook 'my-c++-mode-hook)
;;;; CC-mode配置 http://cc-mode.sourceforge.net/
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
;;;;根據(jù)后綴判斷所用的mode
;;;;注意:我在這里把.h關(guān)聯(lián)到了c++-mode
(setq auto-mode-alist
(append '(("\\.h$" . c++-mode)) auto-mode-alist))
;;;; Python Mode設(shè)置
;(add-to-list 'load-path "/home/caole/lib/emacs-lisp/python-mode-1.0")
;(require 'python-mode)
;;(require 'pycomplete)
;(require 'doctest-mode)
;;;; 注釋配置
;(load-file "/home/caole/lib/emacs-lisp/gnome-doc.el")
(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-layout-window-sizes (quote (("left9" (0.3170731707317073 . 0.9642857142857143)))))
'(ecb-options-version "2.40"))
(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.
)