我的.emacs 23文件.备份用

29 篇文章 0 订阅
20 篇文章 0 订阅
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; cedet configure 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 启动cedet工具
(require 'cedet)
;; Cecet的工程管理功能
 (global-ede-mode t)
;;  Helper tools.
(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.
 '(matlab-shell-ask-MATLAB-for-completions t)
 '(matlab-shell-enable-gud-flag t)
 '(semantic-default-submodes (quote (global-semantic-decoration-mode global-semantic-idle-completions-mode global-semantic-idle-scheduler-mode global-semanticdb-minor-mode global-semantic-idle-summary-mode global-semantic-mru-bookmark-mode)))
 '(semantic-idle-scheduler-idle-time 3))

;;-----------------------
;; semantic自动补齐,Tag功能信息显示等功能
(require 'semantic/ia)
(setq-mode-local c-mode semanticdb-find-default-throttle
		 '(project unloaded system recursive))
(setq-mode-local c++-mode semanticdb-find-default-throttle
		 '(project unloaded system recursive))

;; 用户头文件Include settings
 (require 'semantic/bovine/gcc)
 (require 'semantic/bovine/c)

 (defconst cedet-user-include-dirs
   (list ".." "../include" "../inc" "../common" "../public" "."
         "../.." "../../include" "../../inc" "../../common" "../../public"))

(setq cedet-sys-include-dirs  (list
                               "/usr/include"
                               "/usr/include/bits"
                               "/usr/include/glib-2.0"
                               "/usr/include/gnu"
                               "/usr/include/gtk-2.0"
                               "/usr/include/gtk-2.0/gdk-pixbuf"
                               "/usr/include/gtk-2.0/gtk"
                               "/usr/local/include"
                               "/usr/local/include"
 			      ))

(let ((include-dirs cedet-user-include-dirs))
   (setq include-dirs (append include-dirs cedet-sys-include-dirs))
   (mapc (lambda (dir)
           (semantic-add-system-include dir 'c++-mode)
           (semantic-add-system-include dir 'c-mode))
         include-dirs))

(setq semantic-c-dependency-system-include-path "/usr/include/")

;; TAGS Menu
 (defun my-semantic-hook ()
   (imenu-add-to-menubar "TAGS"))

(add-hook 'semantic-init-hooks 'my-semantic-hook)

;; Semantic DataBase存储位置
(setq semanticdb-default-save-directory
      (expand-file-name "~/.emacs.d/semanticdb"))

;; 使用 gnu global 的TAGS。
(require 'semantic/db-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)

;; 缩进或者补齐hippie-try-expand settings 
(autoload 'senator-try-expand-semantic "senator")

(setq hippie-expand-try-functions-list '
      (
       senator-try-expand-semantic 
       yas/hippie-try-expand
       semantic-ia-complete-symbol 
       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
       try-expand-all-abbrevs))

(defun indent-or-complete () 
  "Complete if point is at end of a
   word, otherwise indent line."  
  (interactive) 
  (if (looking-at
       "\\>") (hippie-expand nil) (indent-for-tab-command) ))

(defun yyc/indent-key-setup () "Set tab as key for
   indent-or-complete" (local-set-key [(tab)] 'indent-or-complete) )

;; C-mode-hooks .  
(defun yyc/c-mode-keys () 
  "description" 
  ;;Semantic functions.  
  (semantic-default-c-setup) 
  (local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu) 
  (local-set-key "\C-cb" 'semantic-mrub-switch-tags) 
  (local-set-key "\C-cR" 'semantic-symref) 
  (local-set-key "\C-cj" 'semantic-ia-fast-jump)
  (local-set-key "\C-cp" 'semantic-ia-show-summary) 
  (local-set-key "\C-cl" 'semantic-ia-show-doc) 
  (local-set-key "\C-cr" 'semantic-symref-symbol) 
  (local-set-key "\C-c/" 'semantic-ia-complete-symbol) 
  (local-set-key [(control return)] 'semantic-ia-complete-symbol) 
  (local-set-key "." 'semantic-complete-self-insert) 
  (local-set-key ">" 'semantic-complete-self-insert) ;; Indent or complete
  (local-set-key [(tab)] 'indent-or-complete) )

(add-hook 'c-mode-common-hook 'yyc/c-mode-keys)

;(defadvice push-mark (around semantic-mru-bookmark activate) "Push
 ;  a mark at LOCATION with NOMSG and ACTIVATE passed to `push-mark'.
  ; If `semantic-mru-bookmark-mode' is active, also push a tag onto
   ;the mru bookmark stack."  (semantic-mrub-push
;			      semantic-mru-bookmark-ring (point) 'mark) 
 ;  ad-do-it)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CC-mode configure o and c/c++ language env.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
;;; C/C++
(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 [(f7)] 'compile)
  (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)
)
'(compile-command "make")
(add-hook 'c-mode-common-hook 'my-c-mode-common-hock)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; c++ configure
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-c++-mode-hook()
  (setq tab-width 4 indent-tabs-mode nil)
  (c-set-style "stroustrup")
;; (define-key c++-mode-map [f3] 'replace-regrexp)
)

;; rurn on font-locking globally
(global-font-lock-mode t)   
;; set coding style
(add-hook 'c-mode-hook 
	  '(lambda()
	     (c-set-style "gnu")))
;;(add-hook 'c++-mode-hook
;;	  '(lambda()
;	     (c-set-style "gnu")
;	     (c-toggle-auto-state)))     ;default "Stroustrup"
;; set linum-mode
(global-linum-mode t)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load path and set emacs environment
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path' "~/.emacs.d/site-lisp")
(require 'color-theme)    ; color_theme
(color-theme-classic)
(setq display-time-day-and-date t)
(display-time)
(setq default-frame-alist  ;设置启动窗口大小 
      `((top . 40)  
        (left . 940)  
        (height . 52)  
        (width . 115)  
        (menu-bar-lines . 20)  
        (tool-bar-lines . 0)    
        )) 
(define-key global-map "\C-c\C-g" 'goto-line)   ;; go to the n-th line

;; show line number
;;(require 'display-line-number)
;;(setq display-line-number-format "%3d")
;;(add-hook 'c-mode-hook 'display-line-number-mode)
;;(add-hook 'c++-mode-hook 'display-line-number-mode)
;; session
;;(require 'session)
;;(add-hook 'after-init-hook 'session-initialize)
;;(load "desktop")
;;(desktop-save-mode)

;;add text-mode hook
(add-hook 'text-mode-hook 'turn-on-auto-fill)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; add chinese wubi input 
;; url:daiyuwen.freeshell.org/gb/wubi/wubi.html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d/site-lisp/")
(require 'wubi)
(wubi-load-local-phrases) ;add user's wubi phrases
(register-input-method
 "chinese-wubi" "Chinese-GB" 'quail-use-package
 "WuBi" "WuBi"
 "wubi") 

(setq default-input-method "chinese-wubi")
(global-set-key [?\C-c ?j] 'toggle-input-method)
;(global-set-key toggle-input-method )
;;; key bindings of WuBi
;(global-set-key [?\C-=] 'add-wubi)
;(global-set-key [?\C--] 'del-wubi)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;set chinese environment
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set-buffer-file-coding-system 'euc-cn)
(prefer-coding-system 'utf-8)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;set matlab-emacs environment
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d/matlab-emacs/matlab-emacs")   ;matlab.el path
(add-to-list 'load-path "/usr/matlab/bin/matlab")                 ; matlab path
(require 'matlab-load)
(autoload 'run-octave "octave-inf" nil t)                         ;special
(autoload 'matlab-mode "matlab" "Enter MATLAB mode." t)
(setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist))
(autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t)

(setq matlab-indent-function-body t)    ; if you want function bodies indented
(setq matlab-verify-on-save-flag nil)   ; turn off auto-verify on save
(defun my-matlab-mode-hook ()
  (setq fill-column 76))		; where auto-fill should wrap
(add-hook 'matlab-mode-hook 'my-matlab-mode-hook)
(defun my-matlab-shell-mode-hook ()
  '())
(add-hook 'matlab-shell-mode-hook 'my-matlab-shell-mode-hook)
(global-font-lock-mode t)
					;  To get hilit19 support try adding:
(require 'tlc)
(autoload 'tlc-mode "tlc" "tlc Editing Mode" t)
(add-to-list 'auto-mode-alist '("\\.tlc$" . tlc-mode))
(setq tlc-indent-function t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; set w3m for webbrowse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'w3m-load)
(require 'mime-w3m)
(require 'w3m)
(autoload 'w3m "w3m" "interface for w3m on emacs" t)
(autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
(autoload 'w3m-search "w3m-search" "Search words using emacs-w3m." t)

;settings
(setq w3m-use-cookies t)
(setq w3m-home-page "http://www.google.com.hk")

;; 默认显示图片
(setq w3m-default-display-inline-image t) 
(setq w3m-default-toggle-inline-images t)

(setq w3m-use-form t)
(setq w3m-tab-width 8)
(setq w3m-use-cookies t)       ;;使用cookies
(setq w3m-use-toolbar t)
(setq w3m-use-mule-ucs t)
;(setq w3m-fill-column 120)
(setq browse-url-browser-function 'w3m-browse-url)
(setq w3m-view-this-url-new-session-in-background t)

;; 使用w3m作为默认浏览器
(setq browse-url-browser-function 'w3m-browse-url)                
(setq w3m-view-this-url-new-session-in-background t)

;;显示图标                                                      
(setq w3m-show-graphic-icons-in-header-line t)                  
(setq w3m-show-graphic-icons-in-mode-line t) 
(defun remove-w3m-output-garbages ()                            
;"去掉w3m输出的垃圾."                                            
(interactive)                                                   
(let ((buffer-read-only))                                       
(setf (point) (point-min))                                      
(while (re-search-forward "[\200-\240]" nil t)                  
(replace-match " "))                                            
(set-buffer-multibyte t))                                       
(set-buffer-modified-p nil))

;;;;;;; Apr. 11, 2013 ;;;
;; emacs set environment
;;设置日历的一些颜色 
(setq calendar-load-hook 
'(lambda () 
(set-face-foreground 'diary-face "skyblue") 
(set-face-background 'holiday-face "slate blue") 
(set-face-foreground 'holiday-face "white"))) 
(add-hook 'message-mode-hook (lambda ()
			       (setq default-fill-column 80) 
			       (turn-on-auto-fill)))
;;切换buffer的设置
(global-set-key [(control o)] 'other-window)
(global-set-key [(control tab)] 'tabbar-forward)

;; download column-marker.el from http://www.emacswiki.org/memacs/ColumnMarker
(require 'column-marker)
;;Highlight column 80 in foo mode:
(add-hook 'foo-mode-hook (lambda () (interactive) (column-marker-1 80)))
;;Use ‘C-c m’ interactively to highlight with ‘column-marker-1-face’:
(global-set-key [?\C-c ?m] 'column-marker-1)
(global-set-key [?\C-c ?n] 'column-marker-3)

;; download fill-column-indicator.el 
;; from http://www.emacswiki.org/emacs/FillColumnIndicator

(require 'fill-column-indicator)
(setq fci-rule-width 1)
(setq fci-rule-color "yellow")
(setq fci-rule-column 80)
(define-globalized-minor-mode global-fci-mode fci-mode (lambda () (fci-mode 1)))
(global-fci-mode 1)





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值