;显示括号匹配
(show-paren-mode t)
;括号匹配时显示另外一边的括号,而不是跳到另一个括号
(setq show-paren-style 'parentheses)
;;显示所在行号和列号
(column-number-mode t)
; 光标显示为一竖线
(setq-default cursor-type 'bar)
; 不要问 yes-or-no,只问 y-or-n
(fset 'yes-or-no-p 'y-or-n-p)
; 设置emacs的标题
(setq frame-title-format "emacs@%b %f")
; 关闭工具栏
(tool-bar-mode -1)
; 正在编辑的文件被其他程序修改时,自动更新缓存区
(global-auto-revert-mode 1)
(desktop-save-mode 1)
;;禁用菜单栏,F10 开启关闭菜单
;(menu-bar-mode nil)
;用空格代替TAB
(setq-default indent-tabs-mode nil)
(when (eq window-system 'x) ; emacs和其它程序互相拷贝
(setq x-select-enable-clipboard t))
; 基本功能的键盘绑定----------------------------
;;C-.记录当前位置,稍后可用C-,跳回来
(global-set-key [(control ?/.)] 'point-to-register)
(global-set-key [(control ?/,)] 'jump-to-register)
(global-set-key (kbd "C-c r") 'replace-string)
(global-set-key (kbd "C-c p") 'delete-indentation)
(global-set-key (kbd "C-c q") 'query-replace)
;; 交换了ctrl 与ATL 键盘后, C-M-/键盘不起作用了
(global-set-key [(control ?//)] 'indent-region)
(global-set-key [f1] 'compile)
;; 设置标记 默认C-SPC 被输入法截获,无法使用
(global-set-key [f2] 'set-mark-command)
;; find . -name "*.[ch] | xargs etags -
;; atl + . 查找一个TAG
;; atl + , 跳到查找之前的位置
(global-set-key [(meta ?/,)] 'pop-tag-mark)
(autoload 'todo-mode "todo-mode"
"Major mode for editing TODO lists." t)
(autoload 'todo-show "todo-mode"
"Show TODO items." t)
(autoload 'todo-insert-item "todo-mode"
"Add TODO item." t)
(defun my-toggle-fullscreen ()
(interactive)
(case system-type
((gnu/linux) (nil))
((mac) (nil))
(otherwise (w32-fullscreen))))
(global-set-key [f12] 'my-toggle-fullscreen)
(require 'flymake)
;;; 自动加载flymake
;(add-hook 'find-file-hooks 'flymake-find-file-hook)
(global-set-key (kbd "<f11>") 'flymake-start-syntax-check)
(global-set-key (kbd "<s-up>") 'flymake-goto-prev-error)
(global-set-key (kbd "<s-down>") 'flymake-goto-next-error)
(global-set-key [f5] 'todo-show)
; 扩展模块---------------------------------------
(add-to-list 'load-path "d:/emacs-23.2/site-lisp/color-theme-6.6.0")
(add-to-list 'load-path "d:/emacs-23.2/site-lisp/")
(add-to-list 'load-path "d:/emacs-23.2/site-lisp/dark-mode")
;;用于w32系统,全屏; M-x w32-fullscreen
(require 'darkroom-mode)
(require 'color-theme)
(color-theme-initialize)
(color-theme-gnome2)
(require 'tabbar)
(tabbar-mode)
;;(global-set-key 'tabbar-backward-group)
;;(global-set-key [(control f10)] 'tabbar-local-mode)
(global-set-key [(control up)] 'tabbar-forward-group)
(global-set-key [(control down)] 'tabbar-backward-group)
(global-set-key [(control left)] 'tabbar-backward)
(global-set-key [(control right)] 'tabbar-forward)
(require 'swbuff)
;(global-set-key (kbd "C-c p") 'swbuff-switch-to-previous-buffer)
;(global-set-key (kbd "C-c n") 'swbuff-switch-to-next-buffer)
(setq swbuff-exclude-buffer-regexps
'("^ " "/*.*/*"))
(setq swbuff-status-window-layout 'scroll)
(setq swbuff-clear-delay 1)
(setq swbuff-separator "|")
(setq swbuff-window-min-text-height 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)
;;用于加亮变量, cedet中也该功能,不过较慢
(require 'highlight-symbol)
(global-set-key [(control f3)] 'highlight-symbol-at-point)
(global-set-key [f3] 'highlight-symbol-next)
(global-set-key [(shift f3)] 'highlight-symbol-prev)
(global-set-key [(meta f3)] 'highlight-symbol-prev)
(require 'ido)
(ido-mode t)
;;---------mew 处理邮件------------------------------
(setq load-path (cons "d:/emacs-23.2/site-lisp/mew-6.3rc2" load-path))
(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil t)
(setq mew-use-cached-passwd t)
(if (boundp 'read-mail-command)
(setq read-mail-command 'mew))
(autoload 'mew-user-agent-compose "mew" nil t)
(if (boundp 'mail-user-agent)
(setq mail-user-agent 'mew-user-agent))
(if (fboundp 'define-mail-user-agent)
(define-mail-user-agent
'mew-user-agent
'mew-user-agent-compose
'mew-draft-send-message
'mew-draft-kill
'mew-send-hook))
(setq mew-pop-size 0)
(setq mew-smtp-auth-list nil)
(setq toolbar-mail-reader 'Mew)
(set-default 'mew-decode-quoted 't)
(setq mew-use-unread-mark t);标示未读邮件
(when (boundp 'utf-translate-cjk)
(setq utf-translate-cjk t)
(custom-set-variables
'(utf-translate-cjk t)))
(if (fboundp 'utf-translate-cjk-mode)
(utf-translate-cjk-mode 1))
;(setq mew-smtp-ssl t)
;(setq mew-pop-ssl t)
;yuxf@sinoufc.com
(setq mew-config-alist '(
("default" ;; default不能写成别的字符串!!
("name" . "yuxf")
("user" . "yuxf")
("smtp-server" . "www.sinoufc.com")
("smtp-port" . "25")
("pop-server" . "www.sinoufc.com")
("pop-port" . "110")
("smtp-user" . "yuxf")
("pop-user" . "yuxf")
("mail-domain" . "sinoufc.com")
("mailbox-type" . pop)
("pop-auth" . pass)
("smtp-auth-list" . ("PLAIN" "LOGIN" "CRAM-MD5"))
)
("sohu"
("name" . "于晓锋")
("user" . "paragenius")
("smtp-server" . "smtp.sohu.com")
("smtp-port" . "25")
("pop-server" . "pop3.sohu.com")
("pop-port" . "110")
("smtp-user" . "paragenius")
("pop-user" . "paragenius")
("mail-domain" . "sohu.com")
("mailbox-type" . pop)
("pop-auth" . pass)
("smtp-auth-list" . ("CRAM-MD5" "LOGIN" "PLAIN" ))
)
))
;; 邮件签名文件
(setq mew-signature-file "~/signature")
;自动插入
(setq mew-signature-as-lastpart t)
(setq mew-signature-insert-last t)
(add-hook 'mew-before-cite-hook 'mew-header-goto-body)
(add-hook 'mew-draft-mode-newdraft-hook 'mew-draft-insert-signature)
;; mew 热键
;; w 写信
;; M-TAB 补齐收信人信息
;; Q 退出mew
;; i 收信
;; g 跳转邮箱
;; o 对邮件进行分类
;; d 把邮件标记为删除
;; * 作星号标记
;; u 清除标记
;; x 对所有标记进行处理
;; a 不带引用的回复,不建议使用
;; A 带引用的回复,推荐
;; f 转发邮件
;; y 保存邮件,会提示是保存整个邮件和是仅保存正文
;; SPACE 阅读邮件
;; ENTER 让阅读的邮件向上滚动一行
;; - 向下滚动一行
;; n 下一封邮件
;; p 前一封邮件
;; j 跳到某一封邮件
;; N 下一封带星号的邮件
;; P 上一封带星号的邮件
;; S 按某个指定项目对邮件排序
;; / 按指定条件搜索邮件,并进入虚拟模式
;; tt 进入虚拟模式,根据线索查看,普通模式下是不可以的
;; C 如果设置了多个邮箱,用此切换
;; C-cC-m 编辑新邮件,放入草稿中
;; C-cC-c 发送邮件
;; C-cC-q 取消草稿
;; C-cC-a 插入附件
;; C-cTAB 插入签名
;; C-cC-l 转换当前邮件的编码格式
;; C-cC-y 复制部分邮件,带引用前缀
;; C-cC-t 复制部分邮件,不带引用前缀
;; C-cC-a 把当前的发信人加入地址薄
;; C-uC-cC-a 比C-cC-a多加入昵称和名字,推荐
;; ;;
;; ;; Biff
;; ;;
(load "biff")
(setq mew-use-cached-passwd t);;必须
(setq mew-use-biff t)
(setq mew-use-biff-bell t)
(setq mew-biff-interval 5) ;这个值一定要小于下面的timer-unit和lifetime值,这个可以使用describe-variable查看一下
(setq mew-pop-biff-interval 3)
(setq mew-passwd-timer-unit 60) ; 60 minutes = 1 hour
(setq mew-passwd-lifetime 24) ; timer-unit x 24 = 24 hours
;;
;;-----------w3m web浏览器配置--------------------------------------------
(add-to-list 'load-path "d:/emacs-23.2/site-lisp/w3m")
(require 'w3m-load)
(require 'w3m-e21)
(provide 'w3m-e23) ;;支持emacs 23
(require 'w3m-lnum)
(setq w3m-use-favicon nil)
(setq w3m-command-arguments '("-cookie" "-F"))
(setq w3m-use-cookies t)
;;使用工具条
(setq w3m-use-toolbar t)
(setq w3m-home-page "http://www.google.com.hk")
;(setq w3m-default-display-inline-images nil)
(setq w3m-display-inline-image t)
;(setq w3m-default-toggle-inline-images nil)
(setq w3m-use-mule-ucs t)
(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 w3m-settings ()
(w3m-link-numbering-mode))
(add-hook 'w3m-mode-hook 'w3m-settings)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "linux")
(setq c-basic-offset 4)))
(add-hook 'c++-mode-hook
'(lambda ()
(c-set-style "linux")
(setq c-basic-offset 4)))
;; Set up for Visual C++ compiling only!!!!!!
(setq compile-command "nmake -f ")
(setenv "INCLUDE" (concat (getenv "INCLUDE") ";C://PROGRAM FILES//COMMON FILES//XFS//SDK//INCLUDE"))
(setenv "LIB" (concat (getenv "LIB") ";C://PROGRAM FILES//COMMON FILES//XFS//SDK//LIB"))
;;;------------------cedet配置----------------
(load-file "d:/emacs-23.2/site-lisp/cedet-1.0pre7/common/cedet.el")
;;;; 使函数体能够折叠或展开
;; Enable source code folding
(global-semantic-tag-folding-mode 1)
;;展开
(define-key semantic-tag-folding-mode-map (kbd "C-c o") 'semantic-tag-folding-fold-block)
;;折上
;(define-key semantic-tag-folding-mode-map (kbd "C-c p") 'semantic-tag-folding-show-block)
; 功能属性,从上到下功能越来越少,性能越来越快
;(semantic-load-enable-excessive-code-helpers)
(semantic-load-enable-code-helpers)
;(semantic-load-enable-minimum-features)
; additional features for name completion and ...
;; smart complitions
(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))
(setq-mode-local erlang-mode semanticdb-find-default-throttle
'(project unloaded system recursive))
(require 'eassist)
;;SRecode是一个模板系统,通过一些预定义的模板,可以很快地插入一段代码。
(setq senator-minor-mode-name "SN")
(setq semantic-imenu-auto-rebuild-directory-indexes nil)
(global-srecode-minor-mode 1)
(global-semantic-mru-bookmark-mode 1)
;; Key bindings
;;
(defun my-cedet-hook ()
(local-set-key [(control return)] 'semantic-ia-complete-symbol)
(local-set-key "/C-c/" 'semantic-ia-complete-symbol-menu)
(local-set-key "/C-cd" 'semantic-ia-show-summary) ;; 在minibuffer中显示变量或者函数的定义
(local-set-key "/C-cj" 'semantic-ia-fast-jump);;跳到函数声明
(local-set-key "/C-cb" 'semantic-mrub-switch-tags)
(local-set-key "/C-cf" 'semantic-symref-symbol)
(local-set-key "/C-cs" 'semantic-symref))
(add-hook 'c-mode-common-hook 'my-cedet-hook)
;; 跳回
(global-set-key [S-f12]
(lambda ()
(interactive)
(if (ring-empty-p (oref semantic-mru-bookmark-ring ring))
(error "Semantic Bookmark ring is currently empty"))
(let* ((ring (oref semantic-mru-bookmark-ring ring))
(alist (semantic-mrub-ring-to-assoc-list ring))
(first (cdr (car alist))))
(if (semantic-equivalent-tag-p (oref first tag)
(semantic-current-tag))
(setq first (cdr (car (cdr alist)))))
(semantic-mrub-switch-tags first))))
;;;---------------------- ECB ----------------------------
;;; ECB 安装之前,需要安装CEDET
;默认情况下,使用鼠标点击ECB窗口中的内容,不起作用。
;可以在Emacs中执行"M-x ecb-customize-most-important",
;找到"Ecb Primary Secondary Mouse Buttons"选项,将其设为"Primary: mouse-1, secondary: mouse-2",
;并且以"Save for Future Sessions"保存。
(add-to-list 'load-path "d:/emacs-23.2/site-lisp/ecb-2.40")
(require 'ecb)
;;;; 自动启动ecb,并且不显示每日提示
;(setq ecb-auto-activate t)
(setq ecb-tip-of-the-day nil)
;;;; 各窗口间切换
(global-set-key [M-left] 'windmove-left)
(global-set-key [M-right] 'windmove-right)
(global-set-key [M-up] 'windmove-up)
(global-set-key [M-down] 'windmove-down)
;;;; 隐藏和显示ecb窗口
(define-key global-map [(control f1)] 'ecb-hide-ecb-windows)
(define-key global-map [(control f2)] 'ecb-show-ecb-windows)
;;;; 使某一ecb窗口最大化
(define-key global-map "/C-c1" 'ecb-maximize-window-directories)
(define-key global-map "/C-c2" 'ecb-maximize-window-sources)
(define-key global-map "/C-c3" 'ecb-maximize-window-methods)
(define-key global-map "/C-c4" 'ecb-maximize-window-history)
;;;; 恢复原始窗口布局
(define-key global-map "/C-c`" 'ecb-restore-default-window-sizes)
;; ------------------文档排版--------------------
(add-to-list 'load-path "d:/emacs-23.2/site-lisp/auctex")
(load "auctex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(load "preview-latex.el" nil t t)
;(setq TeX-output-view-style (quote (("^pdf$" "." "evince %o %(outpage)"))))
(setq TeX-output-view-style (quote (("^pdf$" "." "AcroRd32.exe %o %(outpage)"))))
(add-hook 'LaTeX-mode-hook
(lambda()
(add-to-list 'TeX-command-list '("XeLaTeX" "%`xelatex%(mode)%' %t" TeX-run-TeX nil t))))
(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.40")
'(safe-local-variable-values (quote ((todo-categories "Todo" "study") ))))
(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.
)