思勤无邪

上学时,因我年龄最小,个头也最小,上课时,就像大猩猩堆里的猴一般。如今,这猴偶尔也把最近的一些情况写在这里。

   :: 首页 :: 联系 :: 聚合  :: 管理
  132 Posts :: 1 Stories :: 178 Comments :: 0 Trackbacks

公告

     吾日常三省吾身,曰思、曰勤、曰无邪。

积分与排名

  • 积分 - 177705
  • 排名 - 143

最新随笔

最新评论

阅读排行榜

评论排行榜

;(require 'color-theme)
;(color-theme-initialize)
;(color-theme-tty-dark)
;(color-theme-comidia)
;(color-theme-dark-laptop)

;;;; 显示行号:
(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")

;;;; 显示时间
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)

;;;; 关闭启动画面
(setq inhibit-startup-message t)

;;;;设置大的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++语言启动时自动加载semantic对/usr/include的索引数据库
(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过多
(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公共设置
(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)
  ;;预处理设置
  (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 语言设置
(defun my-c-mode-hook ()
  (c-set-style "cc-mode"))
(add-hook 'c-mode-hook 'my-c-mode-hook)

;; C++设置
(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)

;;;;根据后缀判断所用的mode
;;;;注意:我在这里把.h关联到了c++-mode
(setq auto-mode-alist
      (append '(("\\.h$" . c++-mode)) auto-mode-alist))

;;;; Python Mode设置
;(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.
 )
 
posted on 2010-11-17 20:59 思勤无邪 阅读(1098) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理