Skip to content
This repository

purcell's emacs configuration plus C/C++ support

branch: master

This branch is 0 commits ahead and 0 commits behind master

Octocat-spinner-32 defuns some handy buffer tools from magnars September 22, 2012
Octocat-spinner-32 elpa use ditaa, but still some problme February 17, 2012
Octocat-spinner-32 site-lisp remove sunrise-commander April 16, 2014
Octocat-spinner-32 snippets more angular scripts April 08, 2014
Octocat-spinner-32 .gitignore updated README January 18, 2014
Octocat-spinner-32 .viper Move .viper to .emacs.d directory October 23, 2008
Octocat-spinner-32 typo in README April 16, 2014
Octocat-spinner-32 cl-lib.el cl-lib provide API simulation for other packages December 12, 2013
Octocat-spinner-32 init-ace-jump-mode.el light weight emacs January 21, 2013
Octocat-spinner-32 init-artbollocks-mode.el artbollocks-mode, thanks to Sacha Chua December 25, 2011
Octocat-spinner-32 init-bbdb.el remove obsolete bbdb code May 11, 2013
Octocat-spinner-32 init-cc-mode.el use ggtags set up March 22, 2014
Octocat-spinner-32 init-cmake-mode.el cmake mode January 26, 2012
Octocat-spinner-32 init-company.el lock company-mode support emacs23 April 02, 2014
Octocat-spinner-32 init-compat.el fake emacs24.3 API April 17, 2014
Octocat-spinner-32 init-cperl-mode.el add c++, yasnippet stuff August 31, 2011
Octocat-spinner-32 init-crontab.el Remove redundant crontab-mode config January 10, 2012
Octocat-spinner-32 init-csharp-mode.el csharp-mode in elpa now, optimize loading speed January 17, 2012
Octocat-spinner-32 init-css.el init-css.el should be compatible with web-mode October 30, 2013
Octocat-spinner-32 init-csv.el Move settings from custom.el so that file can be ignored and used for… July 07, 2011
Octocat-spinner-32 init-ctags.el ctags set up March 12, 2014
Octocat-spinner-32 init-dired.el dired mime optimized for different OS June 05, 2013
Octocat-spinner-32 init-doxygen.el doxygen.el January 05, 2013
Octocat-spinner-32 init-eim.el clean emacs.d, cut of 50% start up time January 11, 2013
Octocat-spinner-32 init-elisp.el flymake temp file should be in /tmp/ March 12, 2014
Octocat-spinner-32 init-elnode.el use elnode May 08, 2013
Octocat-spinner-32 init-elpa.el remove lively April 17, 2014
Octocat-spinner-32 init-emacs-w3m.el remove delicious-mode April 16, 2014
Octocat-spinner-32 init-emacspeak.el emacspeak January 16, 2012
Octocat-spinner-32 init-emms.el create directory for emms if needed April 16, 2014
Octocat-spinner-32 init-erlang.el Remove redundant erlang config January 10, 2012
Octocat-spinner-32 init-evil.el use fiplr April 16, 2014
Octocat-spinner-32 init-exec-path.el Fix argument order October 26, 2012
Octocat-spinner-32 init-fill-column-indicator.el add c++, yasnippet stuff August 31, 2011
Octocat-spinner-32 init-flymake.el flymake elisp December 11, 2013
Octocat-spinner-32 init-fonts.el Clarify 'increment-default-font-height February 08, 2012
Octocat-spinner-32 init-frame-hooks.el Extract remaining config blocks in init.el into separate init files b… February 20, 2010
Octocat-spinner-32 init-git.el diff-hunk-next looks better January 22, 2014
Octocat-spinner-32 init-gnus.el gnus set up October 11, 2013
Octocat-spinner-32 init-gtags.el use ggtags set up March 22, 2014
Octocat-spinner-32 init-gud.el gud set up March 18, 2014
Octocat-spinner-32 init-gui-frames.el Make 'increment-default-font-height work in full-screen windows February 08, 2012
Octocat-spinner-32 init-haml.el Revert "remove flymake for coffee, css and haml, install flycheck" May 31, 2013
Octocat-spinner-32 init-haskell.el upgrade haskell stuff May 25, 2013
Octocat-spinner-32 init-helm.el remove helm-ls-git-ls obsolete code April 17, 2014
Octocat-spinner-32 init-hippie-expand.el clean code February 13, 2014
Octocat-spinner-32 init-ibuffer.el use web-mode instead of nxml-mode October 01, 2013
Octocat-spinner-32 init-ido.el lock smex to v2.1 because v3.0 requires emacs24.3 January 21, 2014
Octocat-spinner-32 init-isearch.el Use now-standard 'isearch-occur in place of hand-rolled code January 11, 2012
Octocat-spinner-32 init-javascript.el make js-comint buffer cleaner March 15, 2014
Octocat-spinner-32 init-keyfreq.el add missing init-keyfreq.el January 05, 2012
Octocat-spinner-32 init-linum-mode.el linmu in org-mode is annoying April 18, 2014
Octocat-spinner-32 init-lisp.el fixed startup bug April 16, 2014
Octocat-spinner-32 init-locales.el Don't fail with an error when starting in a terminal environment with… November 24, 2011
Octocat-spinner-32 init-lua-mode.el lua-mode config January 04, 2013
Octocat-spinner-32 init-markdown.el merged from purcell January 15, 2013
Octocat-spinner-32 init-maxframe.el When creating a new frame, maximize it iff previous frame was maximized July 27, 2012
Octocat-spinner-32 init-misc.el no php-mode, web-mode only April 16, 2014
Octocat-spinner-32 init-modeline.el simpler mode-line January 22, 2014
Octocat-spinner-32 init-move-window-buffer.el move window and buffer February 03, 2013
Octocat-spinner-32 init-moz.el simplify init-moz.el March 05, 2014
Octocat-spinner-32 init-org-mime.el use the org-mime from 20130503 and org 20130805 August 06, 2013
Octocat-spinner-32 init-org.el remove comment February 07, 2014
Octocat-spinner-32 init-org2blog.el org2blog support more languages March 06, 2014
Octocat-spinner-32 init-osx-keys.el use web-mode instead of nxml-mode October 01, 2013
Octocat-spinner-32 init-pomodoro.el pomodoro config January 02, 2013
Octocat-spinner-32 init-proxies.el Add (and use) a new string-rtrim function November 02, 2011
Octocat-spinner-32 init-python-mode.el Use \\' instead of $ to mark the end of auto-mode-alist file patterns December 24, 2012
Octocat-spinner-32 init-rcirc.el rcirc tweak December 26, 2011
Octocat-spinner-32 init-recentf.el clean emacs.d, cut of 50% start up time January 11, 2013
Octocat-spinner-32 init-ruby-mode.el clean ruby-mode February 13, 2014
Octocat-spinner-32 init-semantic.el comment on semantic plus complete-symbol August 21, 2012
Octocat-spinner-32 init-sessions.el save history of evil-ex May 10, 2013
Octocat-spinner-32 init-sh.el Switch to my shiny new (and improved) ELPA version of flymake-shell October 12, 2011
Octocat-spinner-32 init-site-lisp.el nxml-mode is fully functional now July 25, 2012
Octocat-spinner-32 init-slime.el slime api changed April 08, 2014
Octocat-spinner-32 init-smartparens.el use smartparens everywhere March 16, 2014
Octocat-spinner-32 init-smex.el lock smex to v2.1 because v3.0 requires emacs24.3 January 21, 2014
Octocat-spinner-32 init-spelling.el fix typo February 07, 2014
Octocat-spinner-32 init-sr-speedbar.el tweak sr-speedbar, no refresh March 23, 2013
Octocat-spinner-32 init-stripe-buffer.el use stripe-buffer April 19, 2013
Octocat-spinner-32 init-term-mode.el remove goto-address. I donot use mouse December 06, 2013
Octocat-spinner-32 init-textile.el merged from purcell January 15, 2013
Octocat-spinner-32 init-thing-edit.el use thing-edit to copy word under cursor October 07, 2011
Octocat-spinner-32 init-uniquify.el Extract remaining config blocks in init.el into separate init files b… February 20, 2010
Octocat-spinner-32 init-utils.el open current html file in firefox November 02, 2012
Octocat-spinner-32 init-web-mode.el ember.js templates April 16, 2014
Octocat-spinner-32 init-which-func.el which-func-mode November 21, 2011
Octocat-spinner-32 init-windows.el new hotkeys for undo/redo windows layout June 08, 2012
Octocat-spinner-32 init-workgroups2.el use workgroups2 November 14, 2013
Octocat-spinner-32 init-xterm.el (mwheel-install) in GUI only, make emacsclient under cygwin work August 10, 2012
Octocat-spinner-32 init-yari.el use web-mode instead of nxml-mode October 01, 2013
Octocat-spinner-32 init-yasnippet.el yasnippet change its naming December 27, 2013
Octocat-spinner-32 init-zencoding-mode.el use web-mode instead of nxml-mode October 01, 2013
Octocat-spinner-32 init.el clean code April 16, 2014


  • I’m using Vim key binding. Please see “Tips” section if you prefer the Emacs key binding.
  • People in Mainland China may need goagent to download packages from ELPA. Run command “http_proxy= emacs -nw” after starting goagent server (or any proxy server).
  • C++/C developers, you need tell Emacs where to search headers to make auto-complete work. See section `clang` for details.
  • I suggest Windows users using Cygwin version Emacs to avoid some overhead of setting up third party tools. But this configuration is still usable even in native windows Emacs.
  • I whitelist packages from melpa because it is too cutting edge. Modify variable “melpa-include-packages” in init-elpa.el if prefer some package from it.
  • Many users have issue to fetch packages from elpa/marmalade/melpa. Check the section “Install packages without elpa/marmalade/melpa” for solutions.


My first priority is -stable-. So I use fewer cutting-edge packages from melpa.

Most modern popular programming languages are supported (C/C++/Java/Ruby/Perl/Python/C#/Lua/Javascript …).


  • All key binding and plugins are usable in terminal
  • Real time HTML syntax checker enabled (you need install tidy)
  • git or subversion is NOT needed. You DONOT need run ‘git submodule update’.
  • optimized for cross-platform C++ development with CMake and wxWidgets
  • emacs-w3m (console browser)
  • eim (Chinese pinyin input method)
  • org2blog (post wordpress blog with org-mode)
  • make the configuration work on ALL platforms (Linux/Cygwin/Mac).
  • The configuration work with Emacs version >=24 but still usable with Emacs version 23 (tested with Emacs 23.4.1).
  • evil-mode and its plugins (Vim key binding)
  • yasnippet and my customized snippets (insert code snippet by typing less keys)


Download this zip file and extract its content into ~/.emacs.d. Ensure that the ‘init.el’ contained in this repo ends up at ~/.emacs.d/init.el and old -~/.emacs IS REMOVED.

Make sure you are connected to the internet.

you may need run the below command in the terminal at least once to update the content from package repositories:

emacs -nw --batch -l ~/.emacs.d/init.el -f package-refresh-contents

Package repository is like Emacs App stores but all the Apps are FREE.

Directory structure

init.el is main file which include all the other *.el files.

init-elpa define how and what packages will be installed from elpa/marmalade/melpa by package manager.

The package manager will extract packages into ~/.emacs.d/elpa/.

I also manually download and extract some packages into ~/.emacs.d/site-lisp/. Packages in ~/.emacs.d/site-lisp/ is not visible to Emacs package manager.

My own snippets for Yasnippet is in ~/.emacs.d/snippets.

Other directoris do not matter.

Third party command line tools

These tools are OPTIONAL. Your Emacs will NOT crash if they are not installed.

w3m (web browser in console)

  • needed by `w3m` (w3m is emacs package name written in elisp)
  • install through OS package manager
  • please note only emacs with GUI can display image


  • required by `flymake-lua`
  • install through OS package manager

aspell or hunspell (RECOMMENDED), and corresponding dictionary (aspell-en, for example)

  • needed by `flyspell`
  • hunspell is the alternative of `aspell`. So you need only install either aspell or hunspell.
  • install through OS package manager
  • I force the dictionary to “en_US” in init-spelling.el. You can modify it in init-spelling.el.

sbcl (lisp environment)

  • needed by lisp `slime`
  • install through OS package manager

tidy (html tidy program)

  • needed by `web-mode` for real time HTML syntax check
  • install through OS package manager


  • install `node.js` through OS package manager, then `sudo npm install -g csslint`

zip and unzip

  • needed by `org-mode` to export org to odt
  • install through OS package manager


  • needed by my clipboard command `copy-to-x-clipboard` and `paste-from-x-clipboard` under Linux
  • install through OS package manager


  • needed by `cpputils-cmake`, `flymake`, `company-clang`
  • install through OS package manager
  • If you use `company-clang` (default), add `(setq company-clang-arguments ‘(“-I/example1/dir” “-I/example2/dir”))` into ~/.emacs.d/init.el
  • If you use `cpputils-cmake` and `cmake`, `cpputils-cmake` will do all the set up for you.

MozRepl firefox addon

  • needed by MozRepl
  • install using firefox


GNU Global

  • needed by `ggtags.el`
  • it creates index files for code navigation
  • more advanced than ctags, supports references and better performance
  • install through OS package manager


  • You need pyflakes for real time python syntax checker like `flymake-python`
  • Install pip through OS package manager, then `pip install pyflakes`
  • On cygwin you need install `setuptool` in order to install `pip`.


  • Only one executable `soffice` needed when converting odt file into doc (Microsoft Word 97)
  • conversion will happen automatically when exporting org-mode to odt
  • The conversion command is in variable `org-export-odt-convert-processes`
  • Install through OS package manager


  • To beautify javascript code (insert extra space, for example)
  • Install pip through OS package manager, then `pip install jsbeautifier`

OS package manager recommended

Install packages without elpa/marmalade/melpa

Solution 1

Here are the exact steps you need follow:

  • Go to
  • Click “Download ZIP”
  • Extract zip somewhere say “~/myelpa”.
  • Double check that there is a file name “archive-contents” in the directory “~/myelpa”.
  • insert below code into of ~/.emacs.d/init.el.
(setq package-archives '(("myelpa" . "~/myelpa/")))

That’s it. You will never need internet connection in the future.

Please note that all your packages are locked to the versions I’m using. So there is no way you can upgrade package online.

I don’t recommend advanced users locking their package version.

Solution 2

If you are too lazy to download ZIP file, you can insert one line into your init.el,

(setq package-archives '(("myelpa" . "")))

Then you are good to go. Obviously you need internet connection to access So your choice.

Report bug

Please file bug report at Don’t send me email!


By default EVIL (Vim emulation in Emacs) is used. You can comment out line containing “(require ‘init-evil)” in init.el to unload it.

Some package cannot be downloaded automatically because of network problem.

You need manually `M-x list-packages` and install it or just `M-x package-refresh-content` and restart Emacs.

If you use `gnus` for email (Gmail, for example). Check ~/.emacs.d/init-gnus.el which includes my most settings except my private stuff. Here is my Gnus tutorial.

To toggle Chinese input method (eim, for example), press `C-` or run command `M-x toggle-input-method`.

My personal custom.el (OPTIONAL)

It’s publicized at It contains my personal stuff like color-theme and time locale.

Something went wrong with that request. Please try again.