emacs配置文件2
;;普通设置
(setq inhibit-startup-message t);关闭起动时闪屏
(setq visible-bell t);关闭出错时的提示声
(show-paren-mode t);显示括号匹配
;(set-default-font "-adobe-courier-medium-r-normal--14-100-100-100-m-90-iso10646-1");;字体设置
(column-number-mode t);显示列号
(setq frame-title-format "%n%F/%b");在窗口的标题栏上显示文件名称
(mouse-avoidance-mode 'animate);光标靠近鼠标指针时,让鼠标指针自动让开
(setq default-frame-alist '((height . 25) (width . 80) (menu-bar-lines . 80) (tool-bar-lines . 80)));设置窗口启动大小
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no
(setq-default make-backup-files nil);;不要生成临时文件
(setq x-select-enable-clipboard t);;允许emacs和外部其他程序的粘贴
(setq mouse-yank-at-point t);支持中键粘贴




;;设置字体
;(set-fontset-font "fontset-default" 'gb18030 '("Microsoft YaHei" . "unicode-bmp"))





;(show-paren-mode 't); 高亮显示匹配括号
;;自动插入匹配的括号
;; enable skeleton-pair insert globally
(setq skeleton-pair t)
(global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
;(global-set-key (kbd "{") 'skeleton-pair-insert-maybe)







;;热键设置
(global-set-key [f9] 'delete-window);F9 关闭d当前窗口
(global-set-key [f8] 'other-window);F8窗口间跳转
(global-set-key [(f2)] 'ansi-term);F2 切换到shell模式
;(global-set-key [f3] 'split-window-vertically);F3分割窗口
(global-set-key [f12] 'my-fullscreen);F12 全屏
(global-set-key [(f4)] 'compile);编译
(global-set-key [f5] 'gdb);启动gdb
(global-set-key [(f6)] 'gdb-many-windows);启动窗口gdb
(global-set-key [f1] 'goto-line);设置M-g为goto-line
;(global-set-key [f7] 'other-frame);跳到其它窗格
(global-set-key [(f3)] 'speedbar);打开speedbar






;;显示行号
(load-file "~/dos/emacs/display-line-number.el")
;;(autoload `display-line-number-mode-on "display-line-number" "display mode" t)
(require 'display-line-number)
(global-display-line-number-mode t)



;;鼠标滚轮,默认的滚动太快,这里改为3行
(defun up-slightly () (interactive) (scroll-up 3))
(defun down-slightly () (interactive) (scroll-down 3))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)




;;代码折
;(add-hook 'c-mode-hook 'hs-minor-mode)
;(add-hook 'c++-mode-hook 'hs-minor-mode)  



;;style I want to use in c mode
(c-add-style "my-style"
         '("stroustrup"
           (indent-tabs-mode . t)        ; 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 . +)
                   (statement-case-open . +)))))




(defun my-c-mode-hook ()
  (c-set-style "my-style")        ; use my-style defined above
;  (c-toggle-auto-hungry-state 1)开启自动缩进
  (auto-fill-mode))

(defun my-c++-mode-hook ()
  (c-set-style "my-style")        ; use my-style defined above
; (c-toggle-auto-hungry-state 1)开启自动缩进
  (auto-fill-mode))

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





       




;;导入cscope
(load-file "~/dos/emacs/cscope-15.6/contrib/xcscope/xcscope.el")
;(add-to-list 'load-path "~/dos/emacs/cscope-15.6/contrib/xcscope")
(require 'xcscope) ;;加载xcscope




;全屏
(defun my-fullscreen ()
  (interactive)
  (x-send-client-message
   nil 0 nil "_NET_WM_STATE" 32
   '(2 "_NET_WM_STATE_FULLSCREEN" 0)))



;;导入cedet
(load-file "~/dos/emacs/cedet-1.0pre4/common/cedet.el")
;(add-to-list 'load-path "~/dos/emacs/cedet-1.0pre4/common/cedet.el")
(require 'cedet) ;;加载cedet
;(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;(semantic-load-enable-minimum-features)
;(semantic-load-enable-code-helpers)
;(semantic-load-enable-guady-code-helpers)
;(semantic-load-enable-excessive-code-helpers)
;(semantic-load-enable-semantic-debugging-helpers)



;;自动补全
(load-file "~/dos/emacs/msf-abbrev.el")
;; ensure abbrev mode is always on
(setq-default abbrev-mode t)
;; do not bug me about saving my abbreviations
(setq save-abbrevs nil)
;; load up modes I use
(require 'cc-mode)
(require 'perl-mode)
(require 'cperl-mode)
(require 'sh-script)
(require 'shell)
;(require 'tex-site) ;; I use AUCTeX
;(require 'latex)    ;; needed to define LaTeX-mode-hook under AUCTeX
;(require 'tex)      ;; needed to define TeX-mode-hook under AUCTeX
;; (require 'python)   ;; I use python.el from Emacs CVS, uncomment if you do also
;; load up abbrevs for these modes
(require 'msf-abbrev)
(setq msf-abbrev-verbose t) ;; optional
(setq msf-abbrev-root "~/dos/emacs/mode-abbrevs")
(global-set-key (kbd "C-c l") 'msf-abbrev-goto-root)
(global-set-key (kbd "C-c a") 'msf-abbrev-define-new-abbrev-this-mode)
(msf-abbrev-load)



;;这个用来生成文档
;(load-file "~/dos/emacs/doxymacs-1.8.0/lisp/doxymacs.el")
;(require 'doxymacs)
;(add-hook 'c-mode-common-hook 'doxymacs-mode)
;(add-hook 'c++-mode-common-hook 'doxymacs-mode)
;(put 'scroll-left 'disabled nil)


;; read pdf
;(load-file "~/dos/emacs/doc-view.el")
;(require 'doc-view)




;(load-file "~/dos/emacs/display-line-number.el")



;;maxima
;;这个实现emaxima写的公式转化到maxima中计算
;(setq emaxima-use-maxima-mode-flag t)
;(add-hook 'emaxima-mode-hook 'emaxima-mark-file-as-emaxima)








;; author: pluskid
;; 调用 stardict 的命令行接口来查辞典
;; 如果选中了 region 就查询 region 的内容,
;; 否则就查询当前光标所在的词
;(global-set-key (kbd "C-c C-d") 'kid-star-dict)
;(defun kid-star-dict ()
;  (interactive)
;  (let ((begin (point-min))
;        (end (point-max)))
;    (if mark-active
;        (setq begin (region-beginning)
;              end (region-end))
;      (save-excursion
;        (backward-word)
;        (mark-word)
;        (setq begin (region-beginning)
;              end (region-end))))
;    ;; 有时候 stardict 会很慢,所以在回显区显示一点东西
;    ;; 以免觉得 Emacs 在干什么其他奇怪的事情。
;    (message "searching for %s ..." (buffer-substring begin end))

;(tooltip-show
;     (shell-command-to-string
;      (concat "sdcv -n "
;              (buffer-substring begin end))))))
;(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.
; '(ecb-options-version "2.32"))
;(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.
; )






;;-----------------------Email mew-----------------------;;
;(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mew")
;(autoload 'mew "mew" nil t)
;(autoload 'mew-send "mew" nil t)
;(setq mew-use-cached-passwd t)

;(setq mew-config-alist '(
;   ("default"
;      ("name" . "cmdblock")
;      ("user" . "student.wangxu")
;      ("mail-domain" . "gmail.com")
;      ("pop-server" . "pop.gmail.com")
;      ("pop-port" . "995")
;      ("pop-user" . "student.wangxu@gmail.com")
;      ("pop-auth" . pass)
;      ("smtp-server" . "smtp.gmail.com")
;      ("smtp-port" . "465")
;      ("smtp-user" . "student.wangxu@gmail.com")
;      ("smtp-auth-list" . ("CRAM-MD5" "LOGIN" "PLAIN")))
;))


 







;;teach yourself emacs in 24 hours
;(setq load-path (cons "~/Emacs" load-path))
;(require 'sams-lib)









;;自动插入匹配的括号
(defun my-c-mode-auto-pair ()
  (setq skeleton-pair t)
  (local-set-key (kbd "(") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "[") 'skeleton-pair-insert-maybe))
(add-hook 'c++-mode-hook 'my-c-mode-auto-pair)
(add-hook 'c-mode-hook 'my-c-mode-auto-pair)
(put 'upcase-region 'disabled nil)







;;meta在常用PC键上就是Alt键
;;这三个绑定主要是光标移动的
;(global-set-key [(meta down)] 'goto-line)
;(global-set-key [(meta left)] 'backward-sexp)
;(global-set-key [(meta right)] 'forward-sexp)









;;配色方案
(load-file "~/dos/emacs/color-theme.el")
(require 'color-theme)
;(add-hook 'c-mode-common-hook 'color-theme-taylor)
;(add-hook 'c++-mode-common-hook 'color-theme-taylor)








;; For my language code setting (UTF-8)
;(setq current-language-environment "UTF-8")
;(setq default-input-method "chinese-py")
;(setq locale-coding-system 'utf-8)
;(set-terminal-coding-system 'utf-8)
;(set-keyboard-coding-system 'utf-8)
;(set-selection-coding-system 'utf-8)
;(prefer-coding-system 'utf-8)





;(global-set-key (kbd "C-SPC") nil)




;;用emacs-wiki写笔记
;(add-to-list 'load-path "~/dos/emacs/emacs-wiki-2.72")
;(require 'emacs-wiki)
;(require 'emacs-wiki-menu)
;;预览
;(defun emacs-wiki-preview-html ()
;(interactive)
;(emacs-wiki-publish-this-page)
;(browse-url (emacs-wiki-published-file)))
;(add-hook 'emacs-wiki-mode-hook
;      (lambda ()
;        (define-key emacs-wiki-mode-map (kbd "C-c C-h") 'emacs-wiki-preview-html)))
;(setq emacs-wiki-maintainer "mailto:student_wangxu@gmail.com")
;;自动发布
;(defun sacha-emacs-wiki-auto-publish ()
;  (when (derived-mode-p 'emacs-wiki-mode)
;    (unless emacs-wiki-publishing-p
;      (let ((emacs-wiki-publishing-p t)
;        (emacs-wiki-after-wiki-publish-hook nil))
;    (emacs-wiki-publish-this-page)))))
;(add-hook 'emacs-wiki-mode-hook
;      (lambda () (add-hook 'after-save-hook
;                   'sacha-emacs-wiki-auto-publish
;                   nil t)))





 



;;使用muse作笔记
;(require 'muse-mode)     ; load authoring mode
;(require 'muse-html)     ; load publishing styles I use
;(require 'muse-latex)
;(require 'muse-texinfo)
;(require 'muse-docbook)
;(require 'muse-project)  ; publish files in projects
;(require 'muse-wiki)
;(require 'muse-book)
;(require 'muse-colors nil t) ; load coloring/font-lock module
;(require 'outline nil t)
;(require 'muse-project)    

;;设置css
;(muse-derive-style "glynweb-html" "html"
;                   :style-sheet "<link rel=\"stylesheet\" type=\"text/css\" 
;media=\"all\" href=\"../css/core.css\" />")  

;(muse-derive-style "cmdblock-html" "html"
;                   :style-sheet "<link rel=\"stylesheet\" type=\"text/css\" 
;media=\"all\" href=\"../../../../Css/core.css\" />")

;;建立项目
;(setq muse-project-alist
;           '(("glynweb" ("~/html/glynweb/glyn" :default "index" )
;              (:base "glynweb-html" :path "~/html/glynweb/glyn"))))

;(setq muse-project-alist
;      `(
;    ("Debian" ;项目名称
;     ("~/muse/source/debian" ;源文件的位置
;      :default "index" ;默认的project的主页
;      :force-publish ("WikiIndex"));发布项目时同时发布project的索引文件
;     (:base "cmdblock-html" :path "~/muse/publish/debian/html")
;     (:base "pdf" :path "~/muse/publish/debian/pdf")) ;发布路径
;    ("Emacs"
;     ("~/muse/source/emacs"
;      :default "index"
;      :force-publish ("WikiIndex"))
;     (:base "cmdblock-html" :path "~/muse/publish/emacs/html")
;     (:base "pdf" :path "~/muse/publish/emacs/pdf"))))











;;
(load-file "~/dos/emacs/tabbar.el")
(require 'tabbar)
(global-set-key (kbd "<left>") 'tabbar-backward-tab)
(global-set-key (kbd "<right>") 'tabbar-forward-tab)







;tramp
;(require 'tramp)
;(setq tramp-default-method "ftp")



;auctex安装
;(load "auctex.el" nil t t)
;(load "preview-latex.el" nil t t)
;(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
;(add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
;(setq TeX-auto-save t)
;(setq TeX-parse-self t)




;(load-file "~/dos/emacs/weblogger.el")
;(require 'weblogger)
;(setq weblogger-server-url "http://cmdblock.blog.51cto.com/")
;(setq weblogger-server-username "cmdblock")
;(setq weblogger-save-password t)
;(global-set-key "\C-cbs" `weblogger-start-entry)