emacs配置-包括clang补全和python补全

仅供存放个人的配置文件,不要在本版发问。
回复
风间星魂
帖子: 490
注册时间: 2009-06-20 23:53

emacs配置-包括clang补全和python补全

#1

帖子 风间星魂 » 2010-11-10 1:17

;;--------------------load-list--------------------
;;-------------------------------------------------

(add-to-list 'load-path "~/.emacs.d/emacsuser/")
(add-to-list 'load-path "~/.emacs.d/emplugin/")
(setq bookmark-default-file "~/.emacs.d/.emacs.bmk") ;;bookmark
(setq abbrev-file-name "~/.emacs.d/.abbrev_defs")

;(setq basic-file-option "~/.emacs.d/emacsuser/basic_file.el ") ;;basic-option
;(load basic-file-option)

(setq custom-file "~/.emacs.d/emacsuser/custom_file.el")
(load custom-file)
;-------------------toolbar----------------

;----------------------------+++++

(setq frame-title-format "fengjian %f [%p-%l]")
(display-time)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq display-time-interval 10)

;----------------key------------
(global-set-key [?\S- ] 'set-mark-command)

;----------------text_basic_style-------
(setq kill-ring-max 1000000)
(show-paren-mode t)
(setq show-paren-style 'parentheses)
(fset 'yes-or-no-p 'y-or-n-p)

(setq x-select-enable-clipboard t)
;(setq-default cursor-type 'bar)
;(setq x-select-enable-clipboard t)
;(set-clipboard-coding-system 'ctext)


(column-number-mode t)
(size-indication-mode t)
(auto-image-file-mode t)
(global-auto-revert-mode t)
(setq default-major-mode 'text-mode)
(setq default-tab-width 4)
(setq tab-width 4 indent-tabs-mode nil)
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-format "%:u %02m/%02d/%04y %02H:%02M:%02S")
(transient-mark-mode t)
(setq-default make-backup-files nil)
(setq visible-bell t)
(condition-case err
(progn
(require 'xxx) )
(error
(message "Can't load xxx-mode %s" (cdr err))))
(setq w3m-default-display-inline-images t) ;w3m images display
(require 'color-theme)
(color-theme-tty-dark)
;------------------ready-only----------
(setq-default comint-prompat-read-only) ;eshell

;--------------------;
(setq inhibit-startup-message t)
(setq gnus-inhibit-startup-message t)

;------------require-----------
(require 'ido)
(ido-mode t)
;(require 'mpg123)
(require 'auto-install)
(require 'yasnippet-bundle)
(require 'auto-complete)
(require 'xcscope)
(global-auto-complete-mode t)
;(auto-install-update-emacswiki-package-name t)
;(setq url-proxy-services '(("http" . "localhost:8339")))
(require 'anything-auto-install)
(setq auto-install-save-confirm nil)
(auto-install-compatibility-setup)


;---------------------
;(require 'desktop)
;(desktop-save-mode t)
;(desktop-load-default)
;(desktop-read)


;----------buffer_try-----------

(global-set-key [(meta ?/)] 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-line
try-expand-line-all-buffers
try-expand-list
try-expand-list-all-buffers
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name
try-complete-file-name-partially
try-complete-lisp-symbol
try-complete-lisp-symbol-partially
try-expand-whole-kill))

(setq calendar-file "~/.emacs.d/emacsuser/calendar_file.el") ;;calendar-option
(load calendar-file)

(setq dict-file "~/.emacs.d/emacsuser/dict_file.el") ;;dict-option
(load dict-file)

;; (setq email-file "~/.emacs.d/emacsuser/email_file.el")
;; (load email-file)
;; (setq erc-file "~/.emacs.d/emacsuser/erc_file.el")
;; (load erc-file)

(setq backup-directory-alist '(("~/.emacs.d/copy"))) ;;copy
(setq auto-install-directory "~/.emacs.d/emplugin/auto-install")


(setq default-directory "~") ;;work-dir

;;------------------------------------------------------------

;----email---
;(require 'bbdb)
;(bbdb-initialize 'gnus 'message)
(setq user-mail-address "xxxxx@gmail.com")

;======================================


;---------------text-----------------------
(add-hook 'text-mode-hook
'(lambda ()
(auto-fill-mode 1)
))

;-------------python---------------

(add-hook 'python-mode-hook
'(lambda ()
(local-set-key "\C-c\C-a" 'completion-at-point)
(linum-mode t)
))

;---------------c/c++---------------------
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "linux")
(linum-mode t)
(semantic-mode t)
(local-set-key "\C-c\C-m" 'compile)
(local-set-key "\C-c\C-b" 'gdb)
;; (visit-tags-table "~/.emacs.d/")

;; (global-ede-mode t)
))


;;------------ac-mode-option--------------

;; (add-to-list 'load-path "~/.emacs.d/emplugin") ; This may not be appeared if you have already added.
;; (add-to-list 'ac-dictionary-directories "~/.emacs.d/emplugin/ac-dict")
;; (require 'auto-complete-config)
;; (ac-config-default)


;; (defun my-ac-c-mode ()
;; (setq ac-sources '(ac-source-semantic
;; ac-source-gtags ac-source-semantic-raw ac-source-dictionary ac-source-yasnippet)))

;; (defun my-ac-py-mode ()
;; (setq ac-sources '( ac-source-gtags
;; ac-source-yasnippet ac-source-dictionary ac-source-words-in-same-mode-buffers)))

;; (add-hook 'c-mode-hook 'my-ac-c-mode)
;; (add-hook 'c++-mode-hook 'my-ac-c-mode)
;; (add-hook 'python-mode-hook 'my-ac-py-mode)





;;---------------end------------------

(setq jabber-account-list
'(("xxxxx@gmail.com"
(:network-server . "talk.google.com")
(:connection-type . ssl))))

(setq-default ispell-program-name "aspell")
(ispell-change-dictionary "american" t)

;;session
;(require 'session)
;(add-hook 'after-init-hook 'session-initialize)

;; doxymacs
;(require 'doxymacs)
;(add-hook 'c-mode-common-hook 'doxymacs-mode) ;;
;(add-hook 'c++-mode-common-hook 'doxymacs-mode) ;;


(setq font-encoding-alist
(append
'(("GB18030" (chinese-gb18030 . 0))
("GBK" (chinese-gbk . 0))
("GB2312" (chinese-gb2312 . 0))
("MuleTibetan-0" (tibetan . 0))
("JISX0208" (japanese-jisx0208 . 0))
("JISX0212" (japanese-jisx0212 . 0))
("VISCII" (vietnamese-viscii-lower . 0))
("KSC5601" (korean-ksc5601 . 0))
("MuleArabic-0" (arabic-digit . 0))
("MuleArabic-1" (arabic-1-column . 0))
("MuleArabic-2" (arabic-2-column . 0)))
font-encoding-alist))


;-------emms----------
(require 'emms-setup)
(emms-standard)
(emms-default-players)
(require 'emms-player-simple)
(require 'emms-source-file)
(require 'emms-source-playlist)
(setq emms-player-list '(emms-player-mpg321
emms-player-ogg123
emms-player-mplayer))
;---------------------
;--------auctex------------
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)


(add-to-list 'ac-dictionary-directories "~/.emacs.d/emplugin/ac-dict")
(require 'auto-complete-config)
(ac-config-default)
(require 'auto-complete-clang)

(setq ac-auto-start nil)
(setq ac-quick-help-delay 0.5)
;; (ac-set-trigger-key "TAB")
;; (define-key ac-mode-map [(control tab)] 'auto-complete)
(define-key ac-mode-map [(control tab)] 'auto-complete)
(defun my-ac-config ()
(setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
(add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
;; (add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'ruby-mode-hook 'ac-ruby-mode-setup)
(add-hook 'css-mode-hook 'ac-css-mode-setup)
(add-hook 'auto-complete-mode-hook 'ac-common-setup)
(global-auto-complete-mode t))
(defun my-ac-cc-mode-setup ()
(setq ac-sources (append '(ac-source-clang ac-source-yasnippet) ac-sources)))
(add-hook 'c-mode-hook 'my-ac-cc-mode-setup)
;; ac-source-gtags
(my-ac-config)




;文件关联,自动将py后缀的文件和pyhton-mod关联
(load "python-mode.el")
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode) interpreter-mode-alist))
;; ;;自动加载,将 python-mode 和文件 python-mode.elc关联
(autoload 'python-mode "python-mode" "Python editing mode." t)
(global-font-lock-mode t) ;语法加亮
(setq font-lock-maximum-decoration t)

(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
(require 'pycomplete)
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))
回复