我的emacs配置

来源:互联网 发布:考勤表app软件下载 编辑:程序博客网 时间:2024/05/17 04:47

要回归emacs了,先晒一下自己的配置吧。

 
;;set c program style
(add-hook 'c-mode-hook 'linux-c-mode)
(setq imenu-sort-function 'imenu--sort-by-name)
(defun linux-c-mode()
 (define-key c-mode-map [return] 'newline-and-indent)
 (interactive)
 (c-set-style "K&R")
 (c-toggle-auto-state)
 (c-toggle-hungry-state)
 (setq c-basic-offset 4)
 (imenu-add-menubar-index)
 (which-function-mode)
)
 
;;set c++ program style
(add-hook 'c++-mode-hook 'linux-cpp-mode)
(defun linux-cpp-mode()
  (define-key c++-mode-map [return] 'newline-and-indent)
  (define-key c++-mode-map [(control c) (c)] 'compile)
  (interactive)
  (c-set-style "K&R")
  (c-toggle-auto-state)
  (c-toggle-hungry-state)
  (setq c-basic-offset 4)
  (imenu-add-menubar-index)
  (which-function-mode)
)

;;python
(setq load-path (cons "/usr/share/emacs/site-lisp/python-mode" load-path))
;;link .py file
(setq auto-mode-alist (cons '(".py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode) interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
;;(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)


;;cscope
(setq cscope-do-not-update-database t)
(load-file "[~/.emacs/xcscope.el]")
(require 'xcscope)

;; cedet for ecb for programming
(load-file "~/.emacs/cedet.el")
;;this enables the database and idle reparse engines
;;(semantic-load-enable-minimum-features)
;;this enables some tools useful for coding, such as summary mode
(semantic-load-enable-code-helpers)
;;this enables even more coding tools such as the nascent intellisense mode
;;(semantic-load-enable-guady-code-helpers)
;;this turns on which func support
;; (semantic-load-enable-excessive-code-helpers)
;; Enable this if you develop in semantic, or develop grammars
;; (semantic-load-enable-semantic-debugging-helpers)

;; ecb
(add-to-list 'load-path "~/.emacs/ecb-2.32")
;;(require 'ecb)
(require 'ecb-autoloads)
(setq semanticdb-project-roots
   (list
        (expand-file-name "/")))
;;(global-set-key (kbd "C-`") 'ecb-goto-window-edit1)
;;(global-set-key (kbd "C-1") 'ecb-goto-window-directories)
;;(global-set-key (kbd "C-2") 'ecb-goto-window-speedbar)
;;(global-set-key (kbd "C-3") 'ecb-goto-window-methods)

;;auto complete
(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
        )
)

;;set compile and save keys
(defun du-onekey-compile ()
  "Save buffers and start compile"
  (interactive)
  (save-some-buffers t)
  (compile compile-command))
(global-set-key [f9] 'compile)
(global-set-key [f5] 'du-onekey-compile)
(global-set-key [f8] 'gdb)

;;set goto line
(global-set-key [(meta g)] 'goto-line)
;;get manual
(global-set-key [(C-f1)] 'manual-entry)

;;set gdb
(load-library "~/.emacs/multi-gud.el")
(load-library "~/.emacs/multi-gdb-ui.el")

;; use ibuffer
(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)

;; tabbar
(load "~/.emacs/tabbar.el")
(require 'tabbar)
(tabbar-mode t)
(global-set-key (kbd "M--") 'tabbar-backward-group)
(global-set-key (kbd "M-=") 'tabbar-forward-group)
(global-set-key (kbd "M-1") 'tabbar-backward)
(global-set-key (kbd "M-2") 'tabbar-forward)

;;set color-theme
(add-to-list 'load-path
   "~/.emacs/color-theme-6.6.0")
(require 'color-theme)
(color-theme-initialize)
(color-theme-dark-laptop)

;;display the column number and line number
(setq column-number-mode t)
(setq line-number-mode t)

;;turn on font-lock mode
(setq global-font-lock-mode t)

;; default desktop
;; save current desktop
(load "desktop")
(desktop-load-default)
(desktop-read)

;;set backup functions
(setq version-control t)
(setq kept-new-versions 3)
(setq delete-old-versions t)
(setq kept-old-versions 2)
(setq backup-directory-alist '(("" . "~/backup/emacs/backup")))
(setq dired-kept-versions 1)

;;set personal info
(setq user-full-name "XXX")
(setq user-mail-address "XXX, <XXX@XXX.com>")

;;template file
(load-library "~/.emacs/template.el")
(require 'template)
(template-initialize)

;;line number
;;no scroll bar, even in X-window
;;(set-scroll-bar-mode nil)
;;(require 'wb-line-number)
;;(wb-line-number-toggle)

;;set max kill ring
(setq kill-ring-max 200)

;;set language
;;(set-language-environment 'Chinese-GBK)
(set-language-environment 'euc-cn)
(set-keyboard-coding-system 'euc-cn)
(set-clipboard-coding-system 'euc-cn)
(set-terminal-coding-system 'euc-cn)
(set-buffer-file-coding-system 'euc-cn)
(set-selection-coding-system 'euc-cn)
(modify-coding-system-alist 'process "*" 'euc-cn)

;;display buffer name
(setq frame-title-format "emacs@%b")

;;others
(setq minibuffer-max-depth nil)
(custom-set-faces)
(mouse-avoidance-mode 'animate)

;;save files on exit
(load "desktop")
(desktop-save-mode)
(desktop-read)

原创粉丝点击