如下: emacs 版本 24.3
;我的配置 ;;1.基本配置 ;;外观配置*************** ;;禁用启动画面 (setq inhibit-startup-message t) ; 设置鼠标为竖线 (setq-default cursor-type 'bar) (show-paren-mode 1) ;(set default 'truncate-lines 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. ;;'(custom-enabled-themes (quote (manoj-dark)))) ;;标记 (define-key global-map [C-return] 'set-mark-command) ;;重新定义函数 ;;(defun lin(number) ;; (interactive) ;; '(goto-line (number))) (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. ) ;;设置文件编码 (prefer-coding-system 'utf-8-unix) (setq default-buffer-file-coding-system 'utf-8-unix) ;;禁止bell (setq visiable-bell t) ;编码设置 ; 写文件为 utf-8 (setq default-buffer-file-coding-system 'utf-8) ;;加载site-lisp 目录 (add-to-list 'load-path "E:/a_bin/emacs/site-lisp") ;;设定启动时窗口大小 frame 大小 ;;(setq initial-frame-alist '((top .10) (left . 30) (width . 90) (height . 24))) ;;(setq default-frame-alist ;; '((height . 23) (width . 80) (top . 0) (left . 0) ;; (menu-bar-lines . 20) (tool-bar-lines . 0))) ;;以上代码设定了Emacs框架的宽度和高度。第一个框架尺寸是在 initial-frame-alist 中设定的, ;;90个字符宽,30 行高 框架左上角坐标为(10,30) ;;后续框架尺寸由 default-frame-alist 定义 ;;80个字符宽,23行高 可设置其他参数 (defun goto-match (arg) (interactive "p") (let ((stop nil) (c 1) (p-save (point)) (forward t) (self "") (target "")) (cond ((looking-at "}") (setq forward nil) (setq self "}") (setq target "{")) ((looking-at "{") (setq forward t) (setq self "{") (setq target "}")) ((looking-at ")") (setq forward nil) (setq self ")") (setq target "(")) ((looking-at "(") (setq forward t) (setq self "(") (setq target ")")) ((looking-at ">") (setq forward nil) (setq self ">") (setq target "<")) ((looking-at "<") (setq forward t) (setq self "<") (setq target ">")) ((looking-at "\\]") (setq forward nil) (setq self "\\]") (setq target "\\[")) ((looking-at "\\[") (setq forward t) (setq self "\\[") (setq target "\\]")) (t (setq stop t) (setq c -1))) (while (not stop) (progn (if forward (forward-char 1) (backward-char 1)) (cond ((looking-at target) (setq c (1- c))) ((looking-at self) (setq c (1+ c)))) (if (or (= c 0) (= (point) (point-max))) (setq stop t)))) (if (= c -1) (self-insert-command (or arg 1))) (if (> c 0) (goto-char p-save)))) ;;字体设置 ;;http://zhuoqiang.me/torture-emacs.html ;; Setting English Font (set-face-attribute 'default nil :font "Monaco 11") ;; Chinese Font (dolist (charset '(kana han symbol cjk-misc bopomofo)) (set-fontset-font (frame-parameter nil 'font) charset(font-spec :family "Microsoft Yahei" :size 16))) ;;(set-fontset-font t 'han(font-spec :family "华文细黑" :size 16)) ;;charset (font-spec :family "Microsoft Yahei" ;; :size 16))) ;; (setq face-font-rescale-alist '(("微软雅黑" . 1.2) ("Microsoft Yahei" . 1.2) ("WenQuanYi Zen Hei" . 1.2))) ;;(set-default-font "TextMate") ;;http://baohaojun.github.io/blog/2012/12/19/perfect-emacs-chinese-font.html ;;(set-fontset-font t 'han(font-spec:family "Microsoft Yahei" :size 16)) ;;去掉工具栏 (tool-bar-mode -1) (menu-bar-mode -1) ;;去掉滚动条 (scroll-bar-mode -1) ;;键绑定**************** ;;缓冲区**************** ;;设定行距 (setq line-spacing 4) ;;页宽. (setq fill-column 80) ;;缺省模式 (setq default-mojor-mode 'text-mode) ;;语法加亮 (global-font-lock-mode t) ;;高亮显示区域选择 (transient-mark-mode t) ;;页面平滑滚动 (setq scroll-margin 3 scroll-conservatively 10000) ;;在标题栏提示目前我的位置 (setq frame-title-format "zym@%b") ;;状态栏****************** ;;标题栏显示%f缓冲区完整路径%p页面百分数%l行号 (setq frame-title-format "%f") ;;编辑器设定*************** ;;使用X剪贴板 (setq x-select-enable-clipboard t) ;;设定剪贴板内容格式 适应firefox (set-clipboard-coding-system 'ctext) ;;其它设置**************** ;;打开图片显示功能 (auto-image-file-mode t) ;;F5 显示/隐藏工具栏 方便调试 (global-set-key [C-f5] 'menu-bar-mode) ;;全屏 ;;(defun toggle-full-screen () (interactive) (shell-command "emacs_fullscreen.exe")) ;;(global-set-key [f11] 'toggle-full-screen) ;; fullscreen ;;(defvar my-full-screen-var nil) ;;(defun toggle-fullscreen () ;; (interactive) ;; (if my-full-screen-var ;; (progn ;; (set-frame-parameter nil 'fullscreen 'nil) ;; (setq my-full-screen-var nil)) ;; (progn ;; (set-frame-parameter nil 'fullscreen 'fullscreen) ;; (setq my-full-screen-var t)))) ;;(global-set-key [f11] 'toggle-fullscreen) ;;;;开发Drupal (require 'php-mode) ;;使用R语言 (require 'ess-site) ;;(setq-default inferior-R-program-name ;; "e:/Users/huitingting/Documents/R/R-2.13.1/bin/i386/Rterm.exe") (setq inferior-R-program-name "e:/Users/huitingting/Documents/R/R-2.13.1/bin/i386/Rterm.exe") ;;======================= ;;CEDET的设置 (add-to-list 'load-path "~/.emacs.d/cedet-1.1/eieio") (add-to-list 'load-path "~/.emacs.d/cedet-1.1/speedbar") (add-to-list 'load-path "~/.emacs.d/cedet-1.0/semantic") (load-file "~/.emacs.d/cedet-1.1/common/cedet.elc") ;;启动EDE (项目管理)特性 (global-ede-mode 1) ;;Install ecb-2.40 (add-to-list 'load-path "~/.emacs.d/ecb-2.40") (load-file "~/.emacs.d/ecb-2.40/ecb.el") (setq stack-trace-on-error t) (require 'ecb) (require 'ecb-autoloads) ;;Lua的环境配置 (autoload 'lua-mode "lua-mode" "Lua editing mode." t) (add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode)) (add-to-list 'interpreter-mode-alist '("lua" . lua-mode)) ;;golang支持 (add-to-list 'load-path "~/.emacs.d/go-mode") (require 'go-mode) ;;Mozilla Rust 支持 (add-to-list 'load-path "~/.emacs.d/rust-mode") (require 'rust-mode) ;; yasnippet (add-to-list 'load-path "~/.emacs.d/yasnippet") (require 'yasnippet) ;; not yasnippet-bundle (yas/initialize) (yas/load-directory "~/.emacs.d/yasnippet/snippets") ;; scala-mode Scala 语言支持 (add-to-list 'load-path "~/.emacs.d/scala-mode") (require 'scala-mode-auto) ;; 编辑.scala文件时自动启用 Scala mode ;; scala yasnippet (setq yas/my-directory "~/.emacs.d/scala-mode/contrib/yasnippet/snippets") (yas/load-directory yas/my-directory) (add-hook 'scala-mode-hook '(lambda () (yas/minor-mode-on) )) ;; scala-ensime ;; (add-to-list 'load-path "~/.emacs.d/ensime/elisp") ;; (require 'ensime) ;; (add-hook 'scala-mode-hook 'ensime-scala-mode-hook) ;; scala mode下自动启用ensime ;;org-mode ;;记事本 (setq org-todo-keywords '((sequence "TODO" "DOING" "HANGUP" "|" "DONE" "CANCEL"))) (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. '(custom-enabled-themes (quote (tango-dark))) '(send-mail-function (quote smtpmail-send-it))) (put 'scroll-left 'disabled nil)