emacs配置

Table of Contents

目前我从github上fork了2个配置(purcell和prelude),同时还clone了一个配置 (Eric Schulte)。

1 emacs使用贴士

  • 运行临时代码的方式有两种,一是将代码写入*scratch*,然后 eval-buffer,快捷键为 C-x,C-e.二是用命令 eval-expression 直接 书写和运行命令,就像shell一样,快捷键为 M-:
  • 新的Emacs集成了org,cedet之类的工具,但是,由于版本等方面的原因,这些 集成的工具非常不方便使用.
    • emacs24中集成的org是7.9版,而最新的是8.x版.我已经针对8.x版进行了 个人配置,而这些配置在旧版不能正常工作.所能采取的办法就是在包管理 器重先删除org,然后再安装org.
    • 如果想把emacs打造成一个IDE,ecb和cedet是常用的工具.但是新版的 emacs只集成一个改版的cedet.这个cedet不能很好地支持ecb.对应方法是 自己下载最新的cedet,手动编译并且在emacs的配置文件一开头手动载入 自己编译的cedet.我采用这个配置安装配置cedet
      cd .emacs.d
      mkdir 3rd-party; cd 3rd-party
      git clone http://git.randomsample.de/cedet.git
      cd cedet
      subl Makefile # modify the variable EMACS=/path/to/emacs
      make
      
      # compile contrib (optional)
      cd contrib
      subl Makefile # modify the variable EMACS=/path/to/emacs
      make
      

      配置 .emacs.d/init.el

      ;; load cedet. It is very important to load cedet early, before Emacs loads the builtin cedet-eieio.
      (load-file "~/.emacs.d/3rd-party/cedet/cedet-devel-load.el")
      
      ; load other programs that work with cedet but not copyright compliant with FSF
      (load-file "~/.emacs.d/3rd-party/cedet/contrib/cedet-contrib-load.el")
      
      ; enable semantic
      (semantic-mode 1)
      (semantic-load-enable-minimum-features)
      (semantic-load-enable-code-helpers)
      

2 purcell

2.1 优点

  • 自动保存上次的桌面
  • 预先配置了ido,用来匹配补全命令和文件名,buffer名
  • 预装了smex,默认与ido同时启动
  • 预装了非常多的东西,光是编译就要十分钟左右
  • 针对Mac系统进行了键位映射,cmd和option互换了

2.2 自定义

2.2.1 配置

  • 将init-editing-utils.el中的save-interprogram-paste-before-kill改为 nil.否则会出现复制粘贴无法使用的问题
  • 使用类似prelude的方式加载自定义elisp文件,自定义文件都位于 lisp/personal文件夹下。

    #+begin_src elisp

;; load the personal settings (defvar personal-dir (expand-file-name "lisp/personal" user-emacs-directory)) (when (file-exists-p personal-dir) (message "Loading personal configuration files in %s…" personal-dir) (mapc 'load (directory-files personal-dir 't "^[^#].*el$")))

(defvar current-user (getenv (if (equal system-type 'windows-nt) "USERNAME" "USER"))) (message "Purcell is ready to do thy bidding, Master %s!" current-user)

#+end_src elisp

  • 自动断行问题
  • 颜色配置问题

2.2.2 要安装的包

  • 添加库到package manager.
    M-: (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
    M-x package-install [RET] marmalade-demo
    
  • 安装monokai颜色主题,运行以下代码.
    (progn
      (package-refresh-contents)
      (package-install 'monokai-theme))
    
  • helm, add (require 'helm) into gneral-init.el
  • projectil

2.3 缺点

  • 与el-get冲突,原因是预装了scratch包.据说可以通过手工把el-get中跟 scratch冲突的内容去掉.
  • 中文自动断行有问题.

3 prelude

3.1 优点

  • 不与el-get冲突
  • 有时会给出emacs使用小贴士
  • 预装了projutil

3.2 自定义

3.2.1 要安装的包

  • auto-complete
  • 添加库到package manager.
    M-: (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
    M-x package-install [RET] marmalade-demo
    
  • 安装monokai颜色主题,运行以下代码.
    (progn
      (package-refresh-contents)
      (package-install 'monokai-theme))
    

3.3 缺点

  • 自定义org-remember时需要声明=(require 'org-remember)=,=(require 'remember)=.
  • 在mac系统下中文输入法有输入后必需打空格或者标点(逗号,句号)才能继续 输入中文的问题.

4 schulte

4.1 优点

4.2 缺点

  • 自定义org-remember时 需要声明=(require 'org-remember)=,=(require 'remember)=.
  • 在mac系统下中文输入法有输入后必需打空格或者标点(逗号,句号)才能继续 输入中文的问题.

Author: Xiao LIU

Created: 2014-10-29 Wed 18:06

Emacs 24.3.1 (Org mode 8.2.10)