我的 .emacs 文件

发布: 2008-07-30 14:42

[code type="lisp"]

;; -*- Emacs-Lisp -*-
;;
;; .emacs -
;;
;; Copyright (C) 2000-2008 刘光照
;;
;; $Locker: $
;; $Log: header.el,v $Revision 1.1 2001/02/01 20:15:57 lasse
;; Author : 刘光照
;; Created On : Thu Apr 3 16:37:05 2008
;; Last Modified By: 刘光照
;; Last Modified On: Thu Apr 3 17:44:14 2008
;; Update Count : 11
;;
;; HISTORY
;; 3-Apr-2008
;; sdfsdfjsdklfjsadoifjsdfisdjfasjdfisadjfisdf
;; 3-Apr-2008
;; sdfsdfsdsfsdfsadf
;; 3-Apr-2008
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/.emacs.d/elisp")

;; 我的测试程序
(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil 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 '("PLAIN" "CRAM-MD5" "LOGIN"));;(setq mew-smtp-auth-list nil)
(setq toolbar-mail-reader 'Mew)
(set-default 'mew-decode-quoted 't)
(setq mew-prog-pgp "gpg")
(setq mew-name "刘光照");;(setq mew-name "显示的用户名")
(setq mew-user "drswinghead");;(setq mew-user "用户名")
(setq mew-smtp-user "drswinghead");;(setq mew-smtp-user "用户名")
(setq mew-mail-domain "163.com");;(setq mew-mail-domain "主机的域名")
(setq mew-use-smtp-auth t);;(setq mew-smtp-auth-list nil)
(setq mew-smtp-server "smtp.163.com");;(setq mew-smtp-server "SMTP主机")
(setq mew-pop-server "pop.163.com");;(setq mew-pop-server "POP主机")
(setq mew-pop-user "drswinghead");;(setq mew-pop-user "用户名")
(setq mew-pop-auth 'pass) ;;认证方式
(setq mew-use-cached-passwd t)
(setq mew-pop-delete nil)
(setq mew-nntp-server "nntp.163.com");;(setq mew-nntp-server "NNTP服务器")
;;(setq mew-icon-directory (expand-file-name "mew/etc" dtsite-dir))
(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))
(require 'flyspell) ;;非常好用的英文的拼写检查

(require 'header2)
(require 'site-gentoo)

;;设置TAB宽度为4
(setq-default indent-tabs-mode nil)
(setq default-tab-width 4)
(setq tab-width 4)
(setq c-basic-offset 4)
(setq truncate-partial-width-windows t)
;;(setq display-time-24hr-format t)
;;(display-time) ;; 显示 24 小时制时间
(setq column-number-mode t)
(setq default-fill-column 80)
(setq user-full-name "刘光照")
(setq header-copyright-notice "Copyright (C) 2000-2008 www.qtchina.net\n" )

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

;;显示指定字体 ,对于gtk-emacs很有用, fc-list 和 xlsfonts
;(set-default-font "-bitstream-bitstream vera sans mono-bold-o-normal--0-0-0-0-m-0-iso8859-1")
;(set-default-font "-bitstream-bitstream vera sans mono-medium-r-normal--0-0-0-0-m-0-ascii-0")
(set-default-font "Bitstream Vera Sans Mono-12")
(set-background-color "#CCE8CF")
;emacs-cvs 冲突,在其中设置信息在.Xresources
;emacs.FontBackend: xft
;Emacs*font: Bitstream Vera Sans Mono-12
;
;设置文本内容到边框的距离
(set-fringe-mode 0)

;两种设置emacs-gtk全屏的方法
;Emacs Frame Properties
(defun fullscreen ()
(interactive)
(set-frame-parameter nil 'fullscreen
(if (frame-parameter nil 'fullscreen) nil 'fullboth)))
(global-set-key [f11] 'fullscreen)

;Send X Messages to the Window Manager
; (defun fullscreen ()
; (interactive)
; (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
; '(2 "_NET_WM_STATE_FULLSCREEN" 0)


;;把c语言风格设置为k&r(5)风格,bsd(8),gnu(2),linux(8),stroustrup,
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "K&R")
(setq c-basic-offset 4)))
(c-set-offset 'substatement-open 0)

(setq inferior-lisp-program "clisp")


(setq muse-html-meta-content-type (concat "text/html; charset=utf-8"))
(setq muse-project-alist
'(("MyWiki"
("~/mydocument/wiki" :default "index")
(:base "html" :path "~/mydocument/wiki/publish"))))

(require 'muse-html) ; load publishing styles I use

;;启动会话管理
;;(require 'session)
;;(add-hook 'after-init-hook 'session-initialize)

;;
;;;;;;;;;;;;启动server
;;(server-start)

;;;;;
;;========== 外观设置 ==========;;
;;去掉工具栏
(tool-bar-mode nil)
;;(tool-bar-mode t)

;;去掉菜单栏,F10 开启关闭菜单
(menu-bar-mode nil)
;;(menu-bar-mode t)

;;去掉滚动栏,使用鼠标滚轮代替
;;(scroll-bar-mode nil)

;;关闭启动画面
;;(setq inhibit-startup-message t)

;;========== 键绑定 ==========;;
;;F10显示/隐藏菜单栏 ;; M-x menu-bar-open
;;(global-set-key (kbd "F10") 'menu-bar-mode)

;;WIN+s进入Shell
;;(global-set-key (kbd "s-s") 'shell)

;; C-z 设置标记 ;; C-z:M-x iconify-or-deiconify-frame:C-z,C-x C-z
;;(global-set-key (kbd "C-z") 'set-mark-command)


;;========== 缓冲区 ==========;;
;;设定行距
;;(setq default-line-spacing 4)
;;页宽
;;(setq default-fill-column 60)

;;缺省主模式 text-mode
;;(setq default-major-mode 'text-mode)

;;设置删除纪录
;;(setq kill-ring-max 200)

;;语法加亮
;;(global-font-lock-mode t)

;;高亮显示区块选择
;;(transient-mark-mode t)

;;防止页面滚动时跳动, scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动,可以很好的看到上下文。
;;(setq scroll-margin 3
;; scroll-conservatively 10000)

;;高亮显示成对括号,但不来回弹跳
;;(show-paren-mode t)
;;(setq show-paren-style 'parentheses)

;;鼠标指针规避光标
;;(mouse-avoidance-mode 'animate)

;;粘贴于光标处,而不是鼠标指针处
;;(setq mouse-yank-at-point t)

;;========== 回显区 ==========;;
;;闪屏报警
;;(setq visible-bell t)

;;使用 y or n 提问
;;(fset 'yes-or-no-p 'y-or-n-p)

;;========== 状态栏 ==========;;
;;显示时间
;;(display-time)

;;显示列号
;;(setq column-number-mode t)

;;标题栏显示 ;; %f 缓冲区完整路径 %p 页面百分数 %l 行号
;;(setq frame-title-format "%f")


;;========== 编辑器设定 ==========;;
;;不生成临时文件
;;(setq-default make-backup-files nil)

;;使用X剪贴板
;;(setq x-select-enable-clipboard t)

;;设定剪贴板内容格式 适应Firefox等程序
;;(set-clipboard-coding-system 'ctext)

;;加快语法高亮显示速度
;;(setq lazy-lock-defer-on-scrolling t)
;;(setq font-lock-support-mode 'lazy-lock-mode)
;;(setq font-lock-maximum-decoration t)

;;将错误信息显示在回显区
;;(condition-case err
;; (progn
;; (require 'xxx) )
;; (error
;; (message "Can't load xxx-mode %s" (cdr err))))

(put 'upcase-region 'disabled nil)
(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)
'(safe-local-variable-values (quote ((todo-categories "Todo" "Todo" "Todo")))))
(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.
)


(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 semanticdb-project-roots
(list
(expand-file-name "/")));;可以设置为项目的顶级目录

;;自动补全绑定按键,ctr+tab,以下三种,任意选择一个,我喜欢第二个
;;(global-set-key [(control tab)] 'senator-complete-symbol);
;;(global-set-key [(control tab)] ' senator-completion-menu-popup)
(global-set-key [(control tab)] 'semantic-ia-complete-symbol-menu)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;; popmenu


[/code]


原文: http://qtchina.tk/?q=node/219

Powered by zexport