.emacs-2013

来源:互联网 发布:360全景生成精灵源码 编辑:程序博客网 时间:2024/05/17 00:56
(set-background-color "black") 
(set-face-background 'default "bisque") ; frame background
;;(set-face-background 'default "cornsilk") ; frame background
(set-face-background 'default "cornsilk") ; frame background
(set-background-color "white") 


(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.
 '(default ((t (:inherit nil :stipple nil :background "cornsilk" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 128 :width normal :foundry "unknown" :family "DejaVu Sans"))))
 '(font-lock-builtin-face ((t (:foreground "Blue"))))
 '(font-lock-comment-face ((t (:foreground "ForestGreen"))))
 '(font-lock-constant-face ((t (:foreground "Red"))))
 '(font-lock-doc-string-face ((t (:foreground "Red"))) t)
 '(font-lock-function-name-face ((t (:foreground "Brown"))))
 '(font-lock-keyword-face ((t (:foreground "Blue"))))
 '(font-lock-other-type-face ((t (:foreground "Blue"))) t)
 '(font-lock-string-face ((t (:foreground "Blue"))))
 '(font-lock-type-face ((t (:foreground "Blue"))))
 '(font-lock-variable-name-face ((t (:foreground "Red"))))
 '(font-lock-warning-face ((t (:foreground "Coral")))))
 








;;; 添加Emacs 搜索路径
(add-to-list 'load-path "~/emacsfpxshyy")
;(load "auto-complete-settings.el")
;(require 'xcscopexcscope)












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








(if (eq system-type 'windows-nt)
    (setq file-name-coding-system 'gbk))
(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.
 '(current-language-environment "UTF-8"))
 (prefer-coding-system 'utf-8)


(setq cscope-do-not-update-database t)
(load-file "/usr/share/emacs/site-lisp/xcscope.el")
(require 'xcscope)


(load-file "/usr/share/emacs23/site-lisp/unicad.el")
(require 'unicad)
(define-key global-map [(control f3)]  'cscope-set-initial-directory)
(define-key global-map [(control f4)]  'cscope-unset-initial-directory)
(define-key global-map [(control f5)]  'cscope-find-this-symbol)
(define-key global-map [(control f6)]  'cscope-find-global-definition)
(define-key global-map [(control f7)]  'cscope-find-global-definition-no-prompting)
(define-key global-map [(control f8)]  'cscope-pop-mark)
(define-key global-map [(control f9)]  'cscope-next-symbol)
(define-key global-map [(control f10)] 'cscope-next-file)
(define-key global-map [(control f11)] 'cscope-prev-symbol)
(define-key global-map [(control f12)] 'cscope-prev-file)
(define-key global-map [(meta f9)]     'cscope-display-buffer)
(define-key global-map [(meta f10)]    'cscope-display-buffer-toggle)










(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)




;; Load CEDET
(load-file "/usr/share/emacs/site-lisp/cedet-common/cedet.el")
(semantic-load-enable-semantic-debugging-helpers)
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ecb")
(require 'ecb)








    (add-hook 'LaTeX-mode-hook (lambda()
                                  (add-to-list 'TeX-command-list '("XeLaTeX" "%`xelatex%(mode)%' %t" TeX-run-TeX nil t))
                                  (setq TeX-command-default "XeLaTeX")
                                     (setq TeX-save-query  nil )
                                      (setq TeX-show-compilation t)
                                                                   ))


;; AUCTeX
(defun auctex ()
  (add-to-list 'TeX-command-list '("XeLaTeX" "%`xelatex%(mode)%' %t; %`xelatex%(mode)%' %t" TeX-run-TeX nil t)) ;; 这里我编译了两次
    (setq TeX-command-default "XeLaTeX") ;; 设定默认编译命令为XeLaTeX
    (setq TeX-save-query nil)            ;; 保存之前不询问
    (setq TeX-show-compilation t))       ;; 在新窗口显示编译过程
(add-hook 'LaTeX-mode-hook 'auctex)








(defun my-latex-mode-hook ()
      (add-to-list 'TeX-command-list
                   '("XeLaTeX" "%`xelatex%(mode)%' %t" TeX-run-TeX nil t))
      (setq TeX-command-default
            (save-excursion
              (save-restriction
                (widen)
                (goto-char (point-min))
                (let ((re (concat "^\\s-*\\\\usepackage\\(?:\\[.*\\]\\)?"
                                  "{.*\\<\\(?:font\\|math\\)spec\\>.*}")))
                  (if (re-search-forward re 3000 t)
                      "XeLaTeX"
                    "LaTeX")))))) 


;If you want to make AUCTEX aware of style files and multi-file documents right away,
;insert the following in your ‘.emacs’ file.


(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)


(setq org-todo-keywords
 '((sequence "TODO" "DOING" "HANGUP" "|" "DONE" "CANCEL")))


(setq org-todo-keywords
      '((sequence "TODO(t)" "DOING(i!)" "HANGUP(h!)" "|" "DONE(d!)" "CANCEL(c!)")))






(setq load-path (cons "~/lib/emacs-lisp/org-7.01h/lisp" load-path))
(setq load-path (cons "~/lib/emacs-lisp/org-7.01h/contrib/lisp" load-path))


(require 'org-install)
(require 'org-publish)
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-hook 'org-mode-hook 'turn-on-font-lock)
(add-hook 'org-mode-hook 
  (lambda () (setq truncate-lines nil)))


(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)


;; iimage mode
(autoload 'iimage-mode "iimage" "Support Inline image minor mode." t)
(autoload 'turn-on-iimage-mode "iimage" "Turn on Inline image minor mode." t)


(if (and (fboundp 'daemonp) (daemonp))
    (add-hook 'after-make-frame-functions
              (lambda (frame)
                (with-selected-frame frame
                  (set-fontset-font "fontset-default"
                                    'chinese-gbk "WenQuanYi Micro Hei Mono 12"))))
  (set-fontset-font "fontset-default" 'chinese-gbk "WenQuanYi Micro Hei Mono 12"))
;(require 'gnuserv) 
;(gnuserv-start) 
(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)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)


;;;;我的C++语言编辑策略
(defun my-c++-mode-hook()
  (setq tab-width 4 indent-tabs-mode nil)
  (c-set-style "stroustrup")
;;  (define-key c++-mode-map [f3] 'replace-regexp)
)


;;(load-file "~/lib/emacs-lisp/cedet-1.0pre3/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
        )
)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)