文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>EMACS 配置文件

EMACS 配置文件

时间:2010-07-29  来源:fengzunbao

;;LOAD_PATH
(add-to-list 'load-path' "/home/study/emacs/emacs_lib")
(add-to-list 'load-path' "/home/study/emacs/emacs_lib/cc-mode")
(add-to-list 'load-path' "/home/study/emacs/emacs_lib/ecb")



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;enable cc mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)

'(compile-command "make")
;;;;;;;;;;cc-mode-hook;;;;;;;;;;;;;;;;;
(defun my-c-mode-common-hook()
  (setq tab-width 4 indent-tabs-mode nil)
  ;;; 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 [(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)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;enable cedet.el;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load-file "/home/study/emacs/emacs_lib/cedet/common/cedet.el")
(setq semanticdb-project-roots
        (list
        (expand-file-name "/")))
(defun my-indent-or-complete ()
   (interactive)
   (if (looking-at "\\>")
         (hippie-expand nil)
       (indent-for-tab-command))
)
(global-set-key [(control tab)] 'my-indent-or-complete)
(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
        )
)
(require 'eldoc)
(require 'semantic-gcc)
(global-ede-mode 1)
(semantic-load-enable-code-helpers)

;;;;;;;;;;;;;;;;;;;;;enable ecb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'ecb)
(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(ecb-auto-activate t)
 '(ecb-compile-window-height 10)
 '(ecb-compile-window-temporally-enlarge (quote after-selection))
 '(ecb-compile-window-width (quote edit-window))
 '(ecb-layout-name "left7")
 '(ecb-options-version "2.32")
 '(ecb-tip-of-the-day nil))


(defun du-onekey-compile ()
  "Save buffers and start compile"
  (interactive)
  (save-some-buffers t)
  (switch-to-buffer-other-window "*compilation*")
  (compile compile-command))
(global-set-key [C-f5] 'compile)
(global-set-key [f5] 'du-onekey-compile)
;;F6 gdb
(global-set-key [f6] 'gdb)
(global-set-key [C-f7] 'previous-error)
(global-set-key [f7] 'next-error)

;;set c++ mode
(add-hook 'c++-mode-hook
'(lambda()
(c-set-style "stroustrup")))

(load-library "hideshow")
(add-hook 'c-mode-hook 'hs-minor-mode)
(add-hook 'c++-mode-hook 'hs-minor-mode)
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'perl-mode-hook 'hs-minor-mode)
(add-hook 'php-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)

(defun my-c-mode-auto-pair ()
  (interactive)
  (make-local-variable 'skeleton-pair-alist)
  (setq skeleton-pair-alist  '(
    (?` ?` _ "''")
    (?\( ?  _ " )")
    (?\[ ?  _ " ]")
    (?{ \n > _ \n ?} >)))
  (setq skeleton-pair t)
  (local-set-key (kbd "(") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "{") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "`") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "[") 'skeleton-pair-insert-maybe))
(add-hook 'c-mode-hook 'my-c-mode-auto-pair)
(add-hook 'c++-mode-hook 'my-c-mode-auto-pair)
;;;;;;;;;;;;;;;;;;;;;some personal operation habbit;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;COLOR_THEME
(require 'color-theme)
(color-theme-arjen)
;;display row and column  number
(require 'display-line-number)
(setq column-number-mode t)
(setq display-line-number-format "%3d ")
;;high light
(global-font-lock-mode t)
;;display the peer ()
(show-paren-mode t)
;;enable ido to show some commands
(require 'ido)
(ido-mode t)
;;set main directory
(setq default-directory "/")
(setq inhibit-startup-message t)
(setq gnus-inhibit-startup-message t)
;;change yes to y, no to n
(fset 'yes-or-no-p 'y-or-n-p)
(setq font-lock-maximum-decoration t)
(setq font-lock-global-modes '(not shell-mode text-mode))
(setq font-lock-verbose t)
(setq font-lock-maximum-size '((t . 1048576) (vm-mode . 5250000)))
(setq kill-ring-max 200)
(setq-default auto-fill-function 'do-auto-fill)
;; Autofill in all modes;;
(setq default-fill-column 120)
;;set text mode
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq show-paren-style 'parenthesis)
;;enable image mode
(setq auto-image-file-mode t)
;;C-x k delete the whole line
(setq-default kill-whole-line t)
;;back up settings
(setq version-control t)
(setq kept-old-versions 2)
(setq kept-new-versions 1)
(setq delete-old-versions t)
(setq backup-directory-alist '(("." . "/home/.backup")))
(setq backup-by-copying t)
;;(setq make-backup-files nil)
;;auto save mode
(setq auto-save-mode nil)
(setq-default make-backup-files nil)
(setq require-final-newline t)
;;set the cur at the end of each line
(setq track-eol t)
;;set home and end key
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
;;scroll left and right
(global-set-key (kbd "C-,") 'scroll-left)
(global-set-key (kbd "C-.") 'scroll-right)
;;set F4 jump other window
(global-set-key [f4] 'other-window)
;;open eshell in other buffer
(defun open-eshell-other-buffer ()
  "Open eshell in other buffer"
  (interactive)
  (split-window-vertically)
  (eshell))
(global-set-key [(f8)] 'open-eshell-other-buffer)
(global-set-key [C-f8] 'eshell)
;;set F10 undo!
(global-set-key [f10] 'undo)
(global-set-key [f11] 'calendar)
(global-set-key [f12] 'list-bookmarks)

;;M-g goto line
(global-set-key (kbd "M-g") 'goto-line)


相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载