;;==================================================
;; Filename: .emacs
;;
;; Copyright: xxx
;; Version: 2.0
;; Author: xxx
;; Created-at: Mon Jun 21 15:56:07 2014
;; Modified_by: 2014-2-28
;; Description: 将此文件重命名为".emacs",并在用户家
;; 目录即可,相关安装插件自己补充与安装,这只是配置文件。
;;==================================================
;; 添加Emacs搜索路径
(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/.emacs.d/plugins")
;;设定语言环境为utf-8
(setq current-language-environment "UTF-8")
(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)
(setq default-sendmail-coding-system 'utf-8-unix);发送邮件编码
;; 从color-theme中获取
;; M-x color-theme-select,鼠标左键选中,回车查看效果
(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-dark-blue2)
;; 使用tabbar.el
(require 'tabbar)
(tabbar-mode)
(global-set-key (kbd "") 'tabbar-backward-group)
(global-set-key (kbd "") 'tabbar-forward-group)
(global-set-key (kbd "") 'tabbar-backward)
(global-set-key (kbd "") 'tabbar-forward)
;;设置字体
(set-default-font "-unknown-DejaVu Sans Mono-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1")
(require 'ibus)
(add-hook 'after-init-hook 'ibus-mode-on)
(global-set-key (kbd "C-M-\\") 'ibus-toggle) ;;通过Ctrl+Mata+\切换输入法
;; 显示时间,格式如下
(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
;;Personal information
(setq user-full-name "xxx")
(setq user-mail-address "xxxx@126.com")
;; 以 y/n代表 yes/no
(fset 'yes-or-no-p 'y-or-n-p)
;;显示标题栏 %f 缓冲区完整路径 %p 页面百分数 %l 行号
(setq frame-title-format "xxxx@%f")
;;缺省模式 text-mode
(setq default-major-mode 'text-mode)
;;设置默认工作目录
(setq default-directory "/home/ubuntu/workfile")
;; 默认显示 80列就换行
(setq default-fill-column 80)
;; 去掉工具栏
(tool-bar-mode nil)
;;去掉菜单栏
;;(menu-bar-mode nil)
;; 去掉滚动栏
(scroll-bar-mode nil)
;; 显示列号
(setq column-number-mode t)
(setq line-number-mode t)
;;高亮显示选中的区域
(transient-mark-mode t)
;;高亮显示成对括号
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;时间栏旁边启用邮件设置
(setq display-time-use-mail-icon t)
;;鼠标指针避光标
(mouse-avoidance-mode 'animate)
;;粘贴于光标处,而不是鼠标指针处
(setq mouse-yank-at-point t)
;; 指针颜色设置为白色
(set-cursor-color "white")
;; 鼠标颜色设置为白色
(set-mouse-color "white")
;;禁用启动信息
(setq inhibit-startup-message t)
;;不要生成临时文件
(setq-default make-backup-files nil)
;关闭自动保存模式
(setq auto-save-mode nil)
;不生成 #filename# 临时文件
(setq auto-save-default nil)
;;打开图片显示功能
(auto-image-file-mode t)
;;设定行距
(setq default-line-spaceing 4)
;;设置删除记录
(setq kill-ring-max 200)
;;以空行结束
(setq require-final-newline t)
;;页面平滑滚动,scroll-margin 3 靠近屏幕边沿3行开始滚动,正好可以看到上下文
(setq scroll-margin 3 scroll-consrvatively 10000)
;;禁止终端响铃
(setq visiable-bell t)
;; 支持emacs和外部程序的粘贴
(setq x-select-enable-clipboard t)
;;语法高亮
(global-font-lock-mode t)
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'LaTeX-hide-environment 'disabled nil)
;;可以递归的使用 minibuffer
(setq enable-recursive-minibuffers t)
;;让 dired 可以递归的拷贝和删除目录
(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
;; 设置缩进
(setq c-basic-offset 4)
(setq indent-tabs-mode nil)
(setq default-tab-width 4)
(setq tab-width 4)
(setq tab-stop-list ())
(loop for x downfrom 40 to 1 do
(setq tab-stop-list (cons (* x 4) tab-stop-list)))
;; 回车缩进
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key (kbd "C-<return>") 'newline)
;; 实现全屏效果,快捷键为f3
(global-set-key [f3] 'my-fullscreen)
(defun my-fullscreen ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_FULLSCREEN" 0))
)
;; 最大化
(defun my-maximized ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
)
;; 启动emacs时窗口最大化
(my-maximized)
;; 启动窗口大小
;(setq default-frame-alist
; '((height . 35) (width . 125) (menu-bar-lines . 20) (tool-bar-lines . 0)))
;;关闭当前窗口
(global-set-key (kbd "M-4") 'delete-window)
;;关闭其他窗口
(global-set-key (kbd "M-1") 'delete-other-windows)
;;水平分割窗口
(global-set-key (kbd "M-2") 'split-window-vertically)
;;垂直分割窗口
(global-set-key (kbd "M-3") 'split-window-horizontally)
;;切换其他窗口
(global-set-key (kbd "M-0") 'other-window)
;;创建其他frame
(global-set-key (kbd "M-5") 'make-frame-command)
;;切换道另一个frame
(global-set-key (kbd "M-6") 'other-frame)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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.
'(column-number-mode t)
'(display-time-mode t)
'(ecb-options-version "2.40")
'(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
'(ecb-source-path (quote ("/home/ubuntu/workfile")))
'(line-number-mode nil)
'(show-paren-mode t)
'(tool-bar-mode nil))
(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 "#233b5a" :foreground "#fff8dc" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;代码折叠
(load-library "hideshow")
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'perl-mode-hook 'hs-minor-mode)
(add-hook 'php-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
;;Group Buffer设置
;;自动进入Topic-mode
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;;Sumarry Buffer设置
(setq gnus-summary-line-format ":%U%R %B %s %-60=|%4L |%-20,20f |%&user-date; \n")
;;Article Buffer设置
;;设定要显示的头消息格式
(setq gnus-visible-headers
"^\\(^To:\\|^CC:\\|^From:\\|^Subject:\\|^Date:\\|^Followup-To:
\\|^X-Newsreader:\\|^User-Agent:\\|^X-Mailer:
\\|Line:\\|Lines:\\|Content-Type:\\|NNTP-Posting-Host\\)")
;; 使用 C++ mode
;;(add-to-list 'auto-mode-alist (cons "\\.h$" #'c++-mode))
;;可以设置对于不同的文件绑定不同的模式,可以用以下语句实现:
;;set *.h and *.c and *.cpp files use c++ mode
(setq auto-mode-alist
(cons '("\\.h$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist
(cons '("\\.c$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist
(cons '("\\.cpp$" . c++-mode) auto-mode-alist))
;; CC-mode配置
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
;;;;我的C/C++语言编辑策略
;;热键设置
;; 按下Alt+/,就会弹出菜单让你自动补全
(define-key c-mode-base-map [(tab)] 'semantic-ia-complete-symbol-menu)
;(global-set-key [f5] 'complile)
;(setq-default compile-command "make")
;(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)
;;_____________C______________
;;C预处理设置
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "c")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq abbrev-mode t)
;;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;;___________CPP______________
;;CPP预处理设置
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq abbrev-mode t)
;;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;;热键设置
(global-set-key [f5] 'complile)
(setq-default compile-command "make")
(global-set-key [f6] 'speedbar)
(global-set-key [f7] 'gdb)
(global-set-key [f8] 'previous-error)
(global-set-key [f9] 'next-error)
;;启动窗口gdb
(global-set-key [f10] 'gdb-many-windows)
;;(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
;;====================== 自动补全功能 =====================
;;自动补全功能,这事从王垠的网站直接Copy过来的,引用一些他对此的说明
;;设置以下 hippie-expand 的补全方式。它是一个优先列表, hippie-expand 会优先使用表最前面
;;的函数来补全这是说,首先使用当前的buffer补全,如果找不到,就到别的可见的窗口里寻找,如
;;还找不到,那么到所有打开的buffer去找,如果还……那么到kill-ring里,到文件名,到简称列表
;;里,到list,当前使用的匹配方式会在 echo 区域显示。
;;特别有意思的是 try-expand-line,它可以帮你补全整整一行文字。我很多时后有两行文字大致相
;;同,只有几个字不一样,但是我懒得去拷贝粘贴以下。那么我就输入这行文字的前面几个字。然后
;;多按几下 M-/ 就能得到那一行。
(global-set-key [(meta ?/)] 'hippie-expand) ;使用hippie-expand补全(M+/快捷键)
(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))
;;hippie的自动补齐策略,优先调用了senator
(autoload 'senator-try-expand-semantic "senator")
;;配置Semantic的检索范围
(setq semanticdb-project-roots
(list
(expand-file-name "/")))
;;自定义自动补齐命令,这部分是抄hhuu的,如果在单词中间就补齐,否则就是tab。
(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) ;使用(c+tab)补全
;;=======================================================================
;;====================== 拷贝代码自动格式化 =====================
;;Emacs 里对代码的格式化支持的非常好,不但可以在编辑的时候自动帮你格式化,还可以选中一块代码,
;;按 Ctrl-Alt-\ 对这块代码重新进行格式化.如果要粘贴一块代码的话,粘贴完了紧接着按 Ctrl-Alt-\,
;;就可以把新加入的代码格式化好。可是,对于这种粘贴加上重新格式化的机械操作,Emacs 应该可以将
;;它自动化才能配得上它的名气,把下面的代码加到配置文件里,你的 Emacs 就会拥有这种能力了
(dolist (command '(yank yank-pop))
(eval
`(defadvice ,command (after indent-region activate)
(and (not current-prefix-arg)
(member major-mode
'( c-mode
c++-mode
clojure-mode
emacs-lisp-mode
haskell-mode
js-mode
latex-mode
lisp-mode
objc-mode
perl-mode
cperl-mode
plain-tex-mode
python-mode
rspec-mode
ruby-mode
scheme-mode))
(let ((mark-even-if-inactive transient-mark-mode))
(indent-region (region-beginning) (region-end) nil))))))
;;=======================================================================
;;===================== 文件头header设置结束
(require 'auto-header) ;加载auto-header.el文件,自动添加文件头
; 设置文件头中的姓名
(setq header-full-name "LaiJia")
; 设置邮箱
(setq header-email-address "laijia2008@126.com")
;; 设置每次保存时要更新的项目
(setq header-update-on-save
'( filename
modified
counter
copyright))
;; 设置文件头的显示格式
(setq header-field-list
'( filename ;文件名
blank ;空行,下同
;;copyright ;;版权
version
author ;作者
created ;创建人
blank
description ;描述
;;blank
;;modified_by ;更改者
;; blank
;;status ;状态,是否发布
;;更新
;;blank
))
;;添加文件头:C-x C-h m
;;添加函数头:C-x C-h f
;;===========================================================================
;;调用linum.el(line number)来显示行号:
(require 'linum)
(global-linum-mode 1)
;;===========================================================================
;;Auto complete
(add-to-list 'load-path "~/.emacs.d/plugins/auto-complete-1.3.1")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/plugins/auto-complete-1.3.1/ac-dict")
(ac-config-default)
(setq ac-use-quick-help nil)
(setq ac-auto-start 2) ;; 输入2个字符才开始补全
(global-set-key "\M-\\" 'auto-complete) ;; 补全的快捷键,用于需要提前补全(M+\)
;; Show menu 0.8 second later
(setq ac-auto-show-menu 0.2)
;; 选择菜单项的快捷键
(setq ac-use-menu-map t)
(define-key ac-menu-map "\C-n" 'ac-next)
(define-key ac-menu-map "\C-p" 'ac-previous)
;; menu设置为12 lines
(setq ac-menu-height 12)
;;==========================================================================
;;安装clang
(require 'auto-complete-clang)
(setq ac-clang-auto-save t)
(setq ac-auto-start t)
(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 ac-clang-flags
(mapcar(lambda (item)(concat "-I" item))
(split-string
"
/usr/include/c++/4.7
/usr/include/i386-linux-gnu/c++/4.7/.
/usr/include/c++/4.7/backward
/usr/lib/gcc/i686-linux-gnu/4.7/include
/usr/local/include
/usr/lib/gcc/i686-linux-gnu/4.7/include-fixed
/usr/include/i386-linux-gnu
/usr/include
")))
(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-common-hook 'my-ac-cc-mode-setup)
;; ac-source-gtags
(my-ac-config)
;;需要说明的几点是:
;ac-clang-flags是头文件的目录,根据系统的不同可能你的头文件目录也会不同,列出系统中所有的头文件目录方法是:
;;$ echo "" | g++ -v -x c++ -E -
;;==========================================================================
;;yasnippet
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
(require 'yasnippet)
(setq yas/prompt-functions
'(yas/dropdown-prompt yas/x-prompt yas/completing-prompt yas/ido-prompt yas/no-prompt))
(yas/global-mode 1)
(yas/minor-mode-on) ; 以minor mode打开,这样才能配合主mode使用
;;=========================================================================
;;格式化整个文件函数
(defun indent-whole ()
(interactive)
(indent-region (point-min) (point-max))
(message "format successfully"))
;;绑定到F4键
(global-set-key [f4] 'indent-whole)
;;========================================================================
;;配置cedet环境
(add-to-list 'load-path "~/.emacs.d/cedet-1.0/common")
(require 'cedet)
(add-to-list 'load-path "~/.emacs.d/cedet-1.0/eieio")
(add-to-list 'load-path "~/.emacs.d/cedet-1.0/semantic")
(require 'semantic-ia)
(require 'semantic-gcc)
(require 'semanticdb-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)
;(semantic-load-enable-primary-exuberent-ctags-support)
;(global-ede-mode 1)
;; Enable SRecode (Template management) minor-mode.
;(global-srecode-minor-mode 1)
;(semantic-load-enable-minimum-features)
;(semantic-load-enable-code-helpers)
;(semantic-load-enable-semantic-debugging-helpers)
;;补全
;(define-key c-mode-base-map (kbd "M-n") 'semantic-ia-complete-symbol-menu)
;(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;;==========================================================================
;;ecb
(add-to-list 'load-path "~/.emacs.d/ecb-2.40/")
(require 'ecb)
(setq ecb-auto-activate t
ecb-tip-of-the-day nil)
(setq ecb-tip-of-the-day nil)
(setq ecb-help-info-start-file nil) ;(require 'ecb-autoloads)
(setq inhibit-startup-message t)
(setq ecb-auto-compatibility-check nil)
(setq ecb-version-check nil)
;;第一次使用时先要设置项目目录,M-x customize-variable ecb-source-path ,在这里加上你的项目根目录。接下来使用M-x ecb-active就能激活ECB了
;;;; 各窗口间切换
(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)
;; Ecb的操作:
;; C-c . g d 目录列表窗口
;; C-c . g s 源码窗口
;; C-c . g m 方法和变量窗口
;; C-c . g h 历史窗口
;; C-c . g l 最后选择过的编辑窗口
;; C-c . g 1 编辑窗口1
;; C-c . g n 编辑窗口n
;; C-c . l c 选择版面
;; C-c . l r 重画版面
;; C-c . l t 拴牢版面(锁定版面)
;; C-c . l w 拴牢可见的ecb窗口
;; C-c . \ 拴牢编绎窗口
;;=========================================================================
;;cscope 设置
;;使用 cscope 浏览源代码,这个xcscope是个改进版,为每一次查找的结果使用不同 buffer ,
;;这样就可以保存以前的结果。
(add-to-list 'load-path "~/.emacs.d/xcscope") ;;将软件包所在的路径加到 EMACS 的 load-path
(require 'xcscope) ;; 加载相应的软件
;; C-c s a 设定初始化的目录,一般是你代码的根目录
;; C-s s I 对目录中的相关文件建立列表并进行索引
;; C-c s s 序找符号
;; C-c s g 寻找全局的定义
;; C-c s c 看看指定函数被哪些函数所调用
;; C-c s C 看看指定函数调用了哪些函数
;; C-c s e 寻找正则表达式
;; C-c s f 寻找文件
;; C-c s i 看看指定的文件被哪些文件include
;;==========================================================================
;;配置flymake 进行语法检查
(autoload 'flymake-find-file-hook "flymake" "" t)
(add-hook 'find-file-hook 'flymake-find-file-hook)
(setq flymake-gui-warnings-enabled nil) ;;flymake-gui-warnings-enabled设置为nil表示出错时不弹个对话框显示错误
(setq flymake-log-level 0);;flymake-log-level设置为0表示记录错误日志。
;;说明:带的flymake对C/C++的支持是通过Makefile实现的,Makefile中必须有一个check-syntax目标,
;;;比如我在Linux下用automake,那我在Makefile.am中加了这么一段(其实就是调用gcc):
;check-syntax:
;$(CXXCOMPILE) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES)
;;==========================================================================
;;gnus设置
;;M-x gnus 启动gnus模式 常用 M-x gnus-other-frame 来新开一个emacs处理
(setq gnus-select-method '(nntp "news.cn99.com")) ;;其他 news.somewhere.cn服务器设置
(setq user-full-name "LaiJia")
(setq user-mail-address "laijia2008@126.com")
; set pop server
(setq mail-sources
'((pop :server "pop.126.com" ;; 在这里设置 pop3 服务器
:user "xxxx@126.com" ;; 用户名
;; :port "pop3"
:password "xxxx"))) ;; 密码
;; set smtp
(setq smtpmail-auth-credentials
'(("smtp.126.com" ;; SMTP 服务器
25 ;; 端口号
"xxxx@126.com" ;; 用户名
"xxxx"))) ;; 密码
(setq smtpmail-default-smtp-server "smtp.126.com")
(setq smtpmail-smtp-server "smtp.126.com")
(setq message-send-mail-function 'smtpmail-send-it)
;M-x mail 发送邮件, C-c C-s 发送,C-c C-c 发送并退出
;M-x rmail 接受邮件
;===========================================================================
;Emacs配置python开发环境
;; Filename: .emacs
;;
;; Copyright: xxx
;; Version: 2.0
;; Author: xxx
;; Created-at: Mon Jun 21 15:56:07 2014
;; Modified_by: 2014-2-28
;; Description: 将此文件重命名为".emacs",并在用户家
;; 目录即可,相关安装插件自己补充与安装,这只是配置文件。
;;==================================================
;; 添加Emacs搜索路径
(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/.emacs.d/plugins")
;;设定语言环境为utf-8
(setq current-language-environment "UTF-8")
(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)
(setq default-sendmail-coding-system 'utf-8-unix);发送邮件编码
;; 从color-theme中获取
;; M-x color-theme-select,鼠标左键选中,回车查看效果
(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-dark-blue2)
;; 使用tabbar.el
(require 'tabbar)
(tabbar-mode)
(global-set-key (kbd "") 'tabbar-backward-group)
(global-set-key (kbd "") 'tabbar-forward-group)
(global-set-key (kbd "") 'tabbar-backward)
(global-set-key (kbd "") 'tabbar-forward)
;;设置字体
(set-default-font "-unknown-DejaVu Sans Mono-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1")
(require 'ibus)
(add-hook 'after-init-hook 'ibus-mode-on)
(global-set-key (kbd "C-M-\\") 'ibus-toggle) ;;通过Ctrl+Mata+\切换输入法
;; 显示时间,格式如下
(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
;;Personal information
(setq user-full-name "xxx")
(setq user-mail-address "xxxx@126.com")
;; 以 y/n代表 yes/no
(fset 'yes-or-no-p 'y-or-n-p)
;;显示标题栏 %f 缓冲区完整路径 %p 页面百分数 %l 行号
(setq frame-title-format "xxxx@%f")
;;缺省模式 text-mode
(setq default-major-mode 'text-mode)
;;设置默认工作目录
(setq default-directory "/home/ubuntu/workfile")
;; 默认显示 80列就换行
(setq default-fill-column 80)
;; 去掉工具栏
(tool-bar-mode nil)
;;去掉菜单栏
;;(menu-bar-mode nil)
;; 去掉滚动栏
(scroll-bar-mode nil)
;; 显示列号
(setq column-number-mode t)
(setq line-number-mode t)
;;高亮显示选中的区域
(transient-mark-mode t)
;;高亮显示成对括号
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;时间栏旁边启用邮件设置
(setq display-time-use-mail-icon t)
;;鼠标指针避光标
(mouse-avoidance-mode 'animate)
;;粘贴于光标处,而不是鼠标指针处
(setq mouse-yank-at-point t)
;; 指针颜色设置为白色
(set-cursor-color "white")
;; 鼠标颜色设置为白色
(set-mouse-color "white")
;;禁用启动信息
(setq inhibit-startup-message t)
;;不要生成临时文件
(setq-default make-backup-files nil)
;关闭自动保存模式
(setq auto-save-mode nil)
;不生成 #filename# 临时文件
(setq auto-save-default nil)
;;打开图片显示功能
(auto-image-file-mode t)
;;设定行距
(setq default-line-spaceing 4)
;;设置删除记录
(setq kill-ring-max 200)
;;以空行结束
(setq require-final-newline t)
;;页面平滑滚动,scroll-margin 3 靠近屏幕边沿3行开始滚动,正好可以看到上下文
(setq scroll-margin 3 scroll-consrvatively 10000)
;;禁止终端响铃
(setq visiable-bell t)
;; 支持emacs和外部程序的粘贴
(setq x-select-enable-clipboard t)
;;语法高亮
(global-font-lock-mode t)
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'LaTeX-hide-environment 'disabled nil)
;;可以递归的使用 minibuffer
(setq enable-recursive-minibuffers t)
;;让 dired 可以递归的拷贝和删除目录
(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
;; 设置缩进
(setq c-basic-offset 4)
(setq indent-tabs-mode nil)
(setq default-tab-width 4)
(setq tab-width 4)
(setq tab-stop-list ())
(loop for x downfrom 40 to 1 do
(setq tab-stop-list (cons (* x 4) tab-stop-list)))
;; 回车缩进
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key (kbd "C-<return>") 'newline)
;; 实现全屏效果,快捷键为f3
(global-set-key [f3] 'my-fullscreen)
(defun my-fullscreen ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_FULLSCREEN" 0))
)
;; 最大化
(defun my-maximized ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
)
;; 启动emacs时窗口最大化
(my-maximized)
;; 启动窗口大小
;(setq default-frame-alist
; '((height . 35) (width . 125) (menu-bar-lines . 20) (tool-bar-lines . 0)))
;;关闭当前窗口
(global-set-key (kbd "M-4") 'delete-window)
;;关闭其他窗口
(global-set-key (kbd "M-1") 'delete-other-windows)
;;水平分割窗口
(global-set-key (kbd "M-2") 'split-window-vertically)
;;垂直分割窗口
(global-set-key (kbd "M-3") 'split-window-horizontally)
;;切换其他窗口
(global-set-key (kbd "M-0") 'other-window)
;;创建其他frame
(global-set-key (kbd "M-5") 'make-frame-command)
;;切换道另一个frame
(global-set-key (kbd "M-6") 'other-frame)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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.
'(column-number-mode t)
'(display-time-mode t)
'(ecb-options-version "2.40")
'(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
'(ecb-source-path (quote ("/home/ubuntu/workfile")))
'(line-number-mode nil)
'(show-paren-mode t)
'(tool-bar-mode nil))
(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 "#233b5a" :foreground "#fff8dc" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;代码折叠
(load-library "hideshow")
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'perl-mode-hook 'hs-minor-mode)
(add-hook 'php-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
;;Group Buffer设置
;;自动进入Topic-mode
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;;Sumarry Buffer设置
(setq gnus-summary-line-format ":%U%R %B %s %-60=|%4L |%-20,20f |%&user-date; \n")
;;Article Buffer设置
;;设定要显示的头消息格式
(setq gnus-visible-headers
"^\\(^To:\\|^CC:\\|^From:\\|^Subject:\\|^Date:\\|^Followup-To:
\\|^X-Newsreader:\\|^User-Agent:\\|^X-Mailer:
\\|Line:\\|Lines:\\|Content-Type:\\|NNTP-Posting-Host\\)")
;; 使用 C++ mode
;;(add-to-list 'auto-mode-alist (cons "\\.h$" #'c++-mode))
;;可以设置对于不同的文件绑定不同的模式,可以用以下语句实现:
;;set *.h and *.c and *.cpp files use c++ mode
(setq auto-mode-alist
(cons '("\\.h$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist
(cons '("\\.c$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist
(cons '("\\.cpp$" . c++-mode) auto-mode-alist))
;; CC-mode配置
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
;;;;我的C/C++语言编辑策略
;;热键设置
;; 按下Alt+/,就会弹出菜单让你自动补全
(define-key c-mode-base-map [(tab)] 'semantic-ia-complete-symbol-menu)
;(global-set-key [f5] 'complile)
;(setq-default compile-command "make")
;(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)
;;_____________C______________
;;C预处理设置
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "c")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq abbrev-mode t)
;;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;;___________CPP______________
;;CPP预处理设置
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq abbrev-mode t)
;;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;;热键设置
(global-set-key [f5] 'complile)
(setq-default compile-command "make")
(global-set-key [f6] 'speedbar)
(global-set-key [f7] 'gdb)
(global-set-key [f8] 'previous-error)
(global-set-key [f9] 'next-error)
;;启动窗口gdb
(global-set-key [f10] 'gdb-many-windows)
;;(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
;;====================== 自动补全功能 =====================
;;自动补全功能,这事从王垠的网站直接Copy过来的,引用一些他对此的说明
;;设置以下 hippie-expand 的补全方式。它是一个优先列表, hippie-expand 会优先使用表最前面
;;的函数来补全这是说,首先使用当前的buffer补全,如果找不到,就到别的可见的窗口里寻找,如
;;还找不到,那么到所有打开的buffer去找,如果还……那么到kill-ring里,到文件名,到简称列表
;;里,到list,当前使用的匹配方式会在 echo 区域显示。
;;特别有意思的是 try-expand-line,它可以帮你补全整整一行文字。我很多时后有两行文字大致相
;;同,只有几个字不一样,但是我懒得去拷贝粘贴以下。那么我就输入这行文字的前面几个字。然后
;;多按几下 M-/ 就能得到那一行。
(global-set-key [(meta ?/)] 'hippie-expand) ;使用hippie-expand补全(M+/快捷键)
(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))
;;hippie的自动补齐策略,优先调用了senator
(autoload 'senator-try-expand-semantic "senator")
;;配置Semantic的检索范围
(setq semanticdb-project-roots
(list
(expand-file-name "/")))
;;自定义自动补齐命令,这部分是抄hhuu的,如果在单词中间就补齐,否则就是tab。
(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) ;使用(c+tab)补全
;;=======================================================================
;;====================== 拷贝代码自动格式化 =====================
;;Emacs 里对代码的格式化支持的非常好,不但可以在编辑的时候自动帮你格式化,还可以选中一块代码,
;;按 Ctrl-Alt-\ 对这块代码重新进行格式化.如果要粘贴一块代码的话,粘贴完了紧接着按 Ctrl-Alt-\,
;;就可以把新加入的代码格式化好。可是,对于这种粘贴加上重新格式化的机械操作,Emacs 应该可以将
;;它自动化才能配得上它的名气,把下面的代码加到配置文件里,你的 Emacs 就会拥有这种能力了
(dolist (command '(yank yank-pop))
(eval
`(defadvice ,command (after indent-region activate)
(and (not current-prefix-arg)
(member major-mode
'( c-mode
c++-mode
clojure-mode
emacs-lisp-mode
haskell-mode
js-mode
latex-mode
lisp-mode
objc-mode
perl-mode
cperl-mode
plain-tex-mode
python-mode
rspec-mode
ruby-mode
scheme-mode))
(let ((mark-even-if-inactive transient-mark-mode))
(indent-region (region-beginning) (region-end) nil))))))
;;=======================================================================
;;===================== 文件头header设置结束
(require 'auto-header) ;加载auto-header.el文件,自动添加文件头
; 设置文件头中的姓名
(setq header-full-name "LaiJia")
; 设置邮箱
(setq header-email-address "laijia2008@126.com")
;; 设置每次保存时要更新的项目
(setq header-update-on-save
'( filename
modified
counter
copyright))
;; 设置文件头的显示格式
(setq header-field-list
'( filename ;文件名
blank ;空行,下同
;;copyright ;;版权
version
author ;作者
created ;创建人
blank
description ;描述
;;blank
;;modified_by ;更改者
;; blank
;;status ;状态,是否发布
;;更新
;;blank
))
;;添加文件头:C-x C-h m
;;添加函数头:C-x C-h f
;;===========================================================================
;;调用linum.el(line number)来显示行号:
(require 'linum)
(global-linum-mode 1)
;;===========================================================================
;;Auto complete
(add-to-list 'load-path "~/.emacs.d/plugins/auto-complete-1.3.1")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/plugins/auto-complete-1.3.1/ac-dict")
(ac-config-default)
(setq ac-use-quick-help nil)
(setq ac-auto-start 2) ;; 输入2个字符才开始补全
(global-set-key "\M-\\" 'auto-complete) ;; 补全的快捷键,用于需要提前补全(M+\)
;; Show menu 0.8 second later
(setq ac-auto-show-menu 0.2)
;; 选择菜单项的快捷键
(setq ac-use-menu-map t)
(define-key ac-menu-map "\C-n" 'ac-next)
(define-key ac-menu-map "\C-p" 'ac-previous)
;; menu设置为12 lines
(setq ac-menu-height 12)
;;==========================================================================
;;安装clang
(require 'auto-complete-clang)
(setq ac-clang-auto-save t)
(setq ac-auto-start t)
(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 ac-clang-flags
(mapcar(lambda (item)(concat "-I" item))
(split-string
"
/usr/include/c++/4.7
/usr/include/i386-linux-gnu/c++/4.7/.
/usr/include/c++/4.7/backward
/usr/lib/gcc/i686-linux-gnu/4.7/include
/usr/local/include
/usr/lib/gcc/i686-linux-gnu/4.7/include-fixed
/usr/include/i386-linux-gnu
/usr/include
")))
(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-common-hook 'my-ac-cc-mode-setup)
;; ac-source-gtags
(my-ac-config)
;;需要说明的几点是:
;ac-clang-flags是头文件的目录,根据系统的不同可能你的头文件目录也会不同,列出系统中所有的头文件目录方法是:
;;$ echo "" | g++ -v -x c++ -E -
;;==========================================================================
;;yasnippet
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
(require 'yasnippet)
(setq yas/prompt-functions
'(yas/dropdown-prompt yas/x-prompt yas/completing-prompt yas/ido-prompt yas/no-prompt))
(yas/global-mode 1)
(yas/minor-mode-on) ; 以minor mode打开,这样才能配合主mode使用
;;=========================================================================
;;格式化整个文件函数
(defun indent-whole ()
(interactive)
(indent-region (point-min) (point-max))
(message "format successfully"))
;;绑定到F4键
(global-set-key [f4] 'indent-whole)
;;========================================================================
;;配置cedet环境
(add-to-list 'load-path "~/.emacs.d/cedet-1.0/common")
(require 'cedet)
(add-to-list 'load-path "~/.emacs.d/cedet-1.0/eieio")
(add-to-list 'load-path "~/.emacs.d/cedet-1.0/semantic")
(require 'semantic-ia)
(require 'semantic-gcc)
(require 'semanticdb-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)
;(semantic-load-enable-primary-exuberent-ctags-support)
;(global-ede-mode 1)
;; Enable SRecode (Template management) minor-mode.
;(global-srecode-minor-mode 1)
;(semantic-load-enable-minimum-features)
;(semantic-load-enable-code-helpers)
;(semantic-load-enable-semantic-debugging-helpers)
;;补全
;(define-key c-mode-base-map (kbd "M-n") 'semantic-ia-complete-symbol-menu)
;(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;;==========================================================================
;;ecb
(add-to-list 'load-path "~/.emacs.d/ecb-2.40/")
(require 'ecb)
(setq ecb-auto-activate t
ecb-tip-of-the-day nil)
(setq ecb-tip-of-the-day nil)
(setq ecb-help-info-start-file nil) ;(require 'ecb-autoloads)
(setq inhibit-startup-message t)
(setq ecb-auto-compatibility-check nil)
(setq ecb-version-check nil)
;;第一次使用时先要设置项目目录,M-x customize-variable ecb-source-path ,在这里加上你的项目根目录。接下来使用M-x ecb-active就能激活ECB了
;;;; 各窗口间切换
(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)
;; Ecb的操作:
;; C-c . g d 目录列表窗口
;; C-c . g s 源码窗口
;; C-c . g m 方法和变量窗口
;; C-c . g h 历史窗口
;; C-c . g l 最后选择过的编辑窗口
;; C-c . g 1 编辑窗口1
;; C-c . g n 编辑窗口n
;; C-c . l c 选择版面
;; C-c . l r 重画版面
;; C-c . l t 拴牢版面(锁定版面)
;; C-c . l w 拴牢可见的ecb窗口
;; C-c . \ 拴牢编绎窗口
;;=========================================================================
;;cscope 设置
;;使用 cscope 浏览源代码,这个xcscope是个改进版,为每一次查找的结果使用不同 buffer ,
;;这样就可以保存以前的结果。
(add-to-list 'load-path "~/.emacs.d/xcscope") ;;将软件包所在的路径加到 EMACS 的 load-path
(require 'xcscope) ;; 加载相应的软件
;; C-c s a 设定初始化的目录,一般是你代码的根目录
;; C-s s I 对目录中的相关文件建立列表并进行索引
;; C-c s s 序找符号
;; C-c s g 寻找全局的定义
;; C-c s c 看看指定函数被哪些函数所调用
;; C-c s C 看看指定函数调用了哪些函数
;; C-c s e 寻找正则表达式
;; C-c s f 寻找文件
;; C-c s i 看看指定的文件被哪些文件include
;;==========================================================================
;;配置flymake 进行语法检查
(autoload 'flymake-find-file-hook "flymake" "" t)
(add-hook 'find-file-hook 'flymake-find-file-hook)
(setq flymake-gui-warnings-enabled nil) ;;flymake-gui-warnings-enabled设置为nil表示出错时不弹个对话框显示错误
(setq flymake-log-level 0);;flymake-log-level设置为0表示记录错误日志。
;;说明:带的flymake对C/C++的支持是通过Makefile实现的,Makefile中必须有一个check-syntax目标,
;;;比如我在Linux下用automake,那我在Makefile.am中加了这么一段(其实就是调用gcc):
;check-syntax:
;$(CXXCOMPILE) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES)
;;==========================================================================
;;gnus设置
;;M-x gnus 启动gnus模式 常用 M-x gnus-other-frame 来新开一个emacs处理
(setq gnus-select-method '(nntp "news.cn99.com")) ;;其他 news.somewhere.cn服务器设置
(setq user-full-name "LaiJia")
(setq user-mail-address "laijia2008@126.com")
; set pop server
(setq mail-sources
'((pop :server "pop.126.com" ;; 在这里设置 pop3 服务器
:user "xxxx@126.com" ;; 用户名
;; :port "pop3"
:password "xxxx"))) ;; 密码
;; set smtp
(setq smtpmail-auth-credentials
'(("smtp.126.com" ;; SMTP 服务器
25 ;; 端口号
"xxxx@126.com" ;; 用户名
"xxxx"))) ;; 密码
(setq smtpmail-default-smtp-server "smtp.126.com")
(setq smtpmail-smtp-server "smtp.126.com")
(setq message-send-mail-function 'smtpmail-send-it)
;M-x mail 发送邮件, C-c C-s 发送,C-c C-c 发送并退出
;M-x rmail 接受邮件
;===========================================================================
;Emacs配置python开发环境