dotemacs

Posted on 2011-04-21 13:06  Binglin Lee  阅读(357)  评论(0)    收藏  举报
.emacs
;; -*- mode:lisp -*-
;; -*- coding:utf-8 -*-

;;File: dotemacs - GUN Emacs's customation file.
;;Author:binglin li
;;CreateDateTime:2011/03/1
;;Version DateTime ChangeLog
;; 0.1 2011/04/13 Add some library:
;; (`ctypes.el' - )
;; (`tabbar.el' - )
;; (`rfringe.el' - )
;; (`color-theme' - color setting)
;; (`yasnippet' - template setting)

(eval-when-compile
(require 'cl))

;;---------------------------------------------------------------------------
;; WORKSHAOP
;;---------------------------------------------------------------------------
;; Setting my home path
(setenv "HOME" "/home/binglinlee")

;;---------------------------------------------------------------------------
;; EMACS LISP PATH
;;---------------------------------------------------------------------------
;;add path to default loading path
(setq load-path (cons "~/.emacs.d/" load-path))
(setq load-path (cons "~/.emacs.d/site-lisp" load-path))
(setq load-path (cons "~/.emacs.d/site-lisp/color-theme-6.6.0" load-path))
(setq load-path (cons "~/.emacs.d/site-lisp/flymake" load-path))
(setq load-path (cons "~/.emacs.d/site-lisp/yasnippet-0.6.1c" load-path))


;;---------------------------------------------------------------------------
;; PACKAGE
;;---------------------------------------------------------------------------
(require 'cc-mode)
(require 'ctypes)
(require 'compile)
(require 'tabbar)
(require 'recentf)
(require 'flymake)
(require 'rfringe)
(require 'color-theme)
(require 'yasnippet-bundle)
(require 'htmlize)

;;---------------------------------------------------------------------------
;; WINDOWS,FRAME,COLOR
;;----------------------------------------------------------------------------
;; Frame title bar formatting to show full path of file
(setq-default frame-title-format
(list
'(
(buffer-file-name " %f"
(dired-directory
dired-directory
(revert-buffer-function " %b"
("%b - Dir: " default-directory)))))))

;; Icon title bar formatting to show full path of file
(setq-default icon-title-format
(list
'(
(buffer-file-name " %f"
(dired-directory
dired-directory
(revert-buffer-function " %b"
("%b - Dir: " default-directory)))))))

;;----------------------------------------------------------------------------
;; CEDET
;;----------------------------------------------------------------------------
(semantic-mode 1)
(setq semantic-default-submodes
global-semantic-idle-scheduler-mode
global-semanticdb-minor-mode.
global-semantic-idle-summary-mode
global-semantic-idle-completions-mode
global-semantic-highlight-func-mode
global-semantic-decoration-mode)

(setq-mode-local c++-mode
semanticdb-find-default-throttle
'( file local project unloaded system recursive omniscience))

;;----------------------------------------------------------------------------
;; CTYPES/CC-MODE
;;----------------------------------------------------------------------------
;(setq c-default-style '((c-mode . "k&r")
; (c++-mode . "ellemtel")
; (other . "linux")))
;
;(c-initialize-cc-mode t)
;(c-init-language-vars-for 'c++-mode)
;(c-common-init 'c++-mode)

; style I want to use in c++ mode
(c-add-style "my-style"
'("stroustrup"
(indent-tabs-mode . nil) ; use spaces rather than tabs
(c-basic-offset . 4) ; indent by four spaces
(c-offsets-alist . ((inline-open . 0) ; custom indentation rules
(brace-list-open . 0)
(statement-case-open . +)))))

(defun my-c++-mode-hook ()
(c-set-style "my-style") ; use my-style defined above
(auto-fill-mode)
(c-toggle-auto-hungry-state 1))

(add-hook 'c++-mode-hook 'my-c++-mode-hook)


(defun my-ctypes-load-hook ()
(ctypes-read-file "~/.emacs.d/.ctypes" nil t t))
(add-hook 'ctypes-load-hook 'my-ctypes-load-hook)

;;----------------------------------------------------------------------------
;; FLYMAKE
;;----------------------------------------------------------------------------
(autoload 'flymake-find-file-hook "flymake" "" t)
(add-hook 'find-file-hook 'flymake-find-file-hook)
(setq flymake-gui-warnings-enabled nil)
(setq flymake-log-level 0)
(rfringe-show-region)

;;---------------------------------------------------------------------------
;; COLOR-THEME
;;---------------------------------------------------------------------------
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
;;(color-theme-aliceblue)
;;(color-theme-sitaramv-nt)
;;(color-theme-feng-shui)
(color-theme-whateveryouwant)
))
;;----------------------------------------------------------------------------
;; COMPILE
;;----------------------------------------------------------------------------
(when (require 'smart-compile+ "smart-compile+" t)
(add-hook 'c-mode-common-hook
(lambda ()(local-set-key "\C-c\C-c" 'smart-compile)))
)


;;----------------------------------------------------------------------------
;; TABBAR
;;----------------------------------------------------------------------------
(tabbar-mode 1)
;; - `tabbar-forward' select the next available tab.
;; - `tabbar-backward' select the previous available tab.
;;
;;(global-set-key [(control .)] 'tabbar-backward)
;;(global-set-key [(control ,)] 'tabbar-forward)

;;----------------------------------------------------------------------------
;; RECENTF
;;----------------------------------------------------------------------------
(recentf-mode 1)

;;----------------------------------------------------------------------------
;; BACKUP
;;----------------------------------------------------------------------------
;;set directory of the backup file
(setq backup-directory-alist
(quote
(("." . "~/.emacs.backup"))))
(setq version-control t)
(setq kept-old-versions 1)
(setq kept-new-versions 1)
(setq delete-old-versions t)
(setq backup-by-copying t)

;;---------------------------------------------------------------------------
;; DESKTOP
;;----------------------------------------------------------------------------
;; give me my last working environment (if I have saved it) )
;;
(load "desktop")
(desktop-load-default)
(desktop-read)

;;---------------------------------------------------------------------------
;; HELP
;;---------------------------------------------------------------------------
(setq Info-default-directory-list
(append '("/usr/local/info")
Info-default-directory-list
'("/usr/share/info")))

;;----------------------------------------------------------------------------
;; PERSION INFOMATION
;;----------------------------------------------------------------------------
(setq user-mail-address "478564021@qq.com")
(setq mail-default-reply-to "478564021@qq.com")

;;----------------------------------------------------------------------------
;; CUSTOMATION
;;----------------------------------------------------------------------------
(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.
'(blink-cursor-mode nil)
'(column-number-mode t)
'(cua-mode t nil (cua-base))
'(debug-on-quit t)
'(display-battery-mode t)
'(display-time-mode t)
'(save-place t nil (saveplace))
'(show-paren-mode t)
'(size-indication-mode t))
(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.
)

(message "binglin Lee ------------------------------------ dotemacs ok!")
(provide '.emacs)