an osx emacs distribution
Emacs Lisp Shell Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is my emacs configuration files, the most different with previous version is now I use el-get as package manager.


Many packages are installing from source. so you need to install xcode command line tools first to compile some source code.

just type command below and fllow the instructions.


and then click install button.

verify your install by

$ xcode-select -p


a simple way, you can directly install emacs and all it’s dependency by script below

\curl -sSL | bash

all configuration described by section below will be execute by script above automatically.


if you have already install this emacs, you can always update the configuration by

cd ~/.emacs.d/
git pull


basic key binding notes

shortcutconresponding key

key binding setting

advice for mac users, switch caplock and left control:

System preferences-> keyboard -> keyboard tab -> modifier keys(right buttom corner)-> change Caps Lock Key -> ^Control


naming and custom keybingding without conflicts must be the hardest thing in emacs configuration

here only descript custom or package provide function keybinding. for emacs buildin editing please read the tutorial by C-h t. or here

usually edit keybinding are global.





custom function

C-c wcopy-work
C-c jcopy-line
C-c ocopy-paragraph
C-c ucopy-string


C-c SPCace-jump-word-modeenter first character of a word, select the highlighted key to move to it.
C-u C-c SPCace-jump-char-modeenter a character for query, select the highlighted key to move to it.
C-u C-u C-c SPCace-jump-line-modeeach non-empty line will be marked, select the highlighted key to move to it.


C-S-c C-S-cmc/edit-lines
C-c C-<mc/mark-all-like-this


C-=er/expand-regionincrease selected region by unit



key bindingdescription
C-c p f,Display a list of all files in the project. With a prefix argument it will clear the cache first.
C-c p d,Display a list of all directories in the project. With a prefix argument it will clear the cache first.
C-c p T,Display a list of all test files(specs, features, etc) in the project.
C-c p l,Display a list of all files in a directory (that’s not necessarily a project)
C-c p g,Run grep on the files in the project.
C-c p b,Display a list of all project buffers currently open.
C-c p o,Runs multi-occur on all project buffers currently open.
C-c p r,Runs interactive query-replace on all files in the projects.
C-c p i,Invalidates the project cache (if existing).
C-c p R,Regenerates the projects TAGS file.
C-c p k,Kills all project buffers.
C-c p D,Opens the root of the project in dired.
C-c p e,Shows a list of recently visited project files.
C-c p a,Runs ack on the project. Requires the presence of ack-and-a-half.
C-c p A,Runs ag on the project. Requires the presence of ag.el.
C-c p c,Runs a standard compilation command for your type of project.
C-c p p,Runs a standard test command for your type of project.
C-c p z,Adds the currently visited to the cache.
C-c p s,Display a list of known projects you can switch to.


⌘-tGo to File
⇧⌘-tGo to Symbol
⌘-tGo to Line
⇧⌘-lSelect Line (or expand Selection to select lines)
⌘-/Comment Line (or Selection/Region)
⌘-]Shift Right (currently indents region)
⌘-[Shift Left (not yet implemented)
⌥⌘-]Align Assignments
⌥⌘-[Indent Line
⌥↑Column Up
⌥↓Column Down
⌘-RETInsert Newline at Line’s End
⌥⌘-TReset File Cache (for Go to File)

version control (magit)

C-c mmagit-statusOpen a Magit status buffer for the Git repository containing DIR.
magit-add-remoteadd the remote and fetch it(git remote add REMOTE URL)
M (1,2,3,4)magit-show-level-(x)
C-u iignore by patten not specific item


rspec test

C-c , ttoggle back and forth between a spec and its target
C-c , vverify the spec file associated with the current buffer
C-c , sverify the example defined at the point of the current buffer
C-c , rre-run the last verification process
C-c , dtoggle the pendingness of the example at the point
C-c , arun all specifications for project


C-c C-r prubocop-check-projectRuns RuboCop on the entire project
C-c C-r drubocop-check-directoryPrompts from a directory on which to run RuboCop
C-c C-r frubocop-check-current-fileRuns RuboCop on the currently visited file
C-c C-r Prubocop-autocorrect-projectRuns auto-correct on the entire project
C-c C-r Drubocop-autocorrect-directoryPrompts for a directory on which to run auto-correct
C-c C-r Frubocop-autocorrect-current-fileRuns auto-correct on the currently visited file.

using emacs you only need to known above

package manage

Since emacs version 24, emacs has buildin elpa as it’s default package system. But official repo can not contain every package either every new versions of a package. Not every author like to contribute his package to the official repo. most of them just put it on github or even his own blog.

el-get support almost every kind a package source, including elpa, wiki, github, ftp and so on. So el-get has more abundant package resouces.

now you only need to configure and manage your package recipe instead of whole package. there is already most recipe in hand contributed by others. based on package recipes, maintainance and update became more easier.

el-get also support customized initial script.

most important, el-get is vert activity by now. and it is the most powerfull packge manager as I know.


emacs that comes with osx is still 22.1.1, even you have upgrade your operation system 10.9. it pretty old and difficult to use. why not apple just do not pre-bundled such emacs.

for mac users those who don’t want to have heavy configuration, my suggestion is emacs for osx, its have advantage against others in such field:

  1. newer
  2. cocoa not X11
  3. retina

that is the default version installed by install section.

emacsforosx have different color behaviour. so the color theme may not the same as you saw them in a screen snapshot.

for mac user those want to toss of emacs, just brew install it by source code. you can control many things through pass different compile flags.

brew install emacs --cocoa

brew linkapps  #make symbolic to /Applications/
# let some command like emacsclient also available at /Applications/ location
ln -s /usr/local/Cellar/emacs/HEAD/bin/ /Applications/

for Alfred to index Emacs app add usr/local/Cellar into Alfred’s search scope to find Emacs


command line launch

if you want to lanuch emacs from command line, add such command alias to your .bash_profile or .zshrc

alias emacs='/Applications/ -nw'

or add a script file /usr/bin/emacs this is better I think, cas many third party package would assume the emacs path to be ’usr/bin‘, for example magit. so only terminal know how to find executable emacs but not emacs itself if you only add a alias.

/Applications/ -nw



for those using emacsosxna

git clone
cd emacs-daemon-osx
cp org.gnu.emacs.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/org.gnu.emacs.plist
rm -r /Applications/
cp -r /Applications


  1. create a plist file in ~/Library/LaunchAgents, for exapmle org.gnu.emacs.daemon.plist
<?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
  <plist version="1.0">
      <string>Gnu Emacs Daemon</string>

next time you login, os will automatic launch program descript in LaunchAgents.

making a shortcut in you .bash_profile

alias e='emacsclient -t' 

another method:

  1. create a applescript. paste below
tell application "Terminal"
 do shell script "/Applications/ --daemon"

add this to users login tem


packages I use frequenctly. I will eventually add a description to the usage of every packge if have time.

with * prefix is package not used currently

  • babel
  • coffee-mode
  • dired+
  • haml-mode
  • flymake
  • flycheck

    Modern on-the-fly syntax checking

  • js2-mode
  • json
  • magit
  • git-commit-mode
  • package
  • rinari
  • rspec-mode
  • ruby-block
  • inf-ruby

    inf-ruby provides a REPL buffer connected to a Ruby subprocess.

  • ruby-compilation
  • ruby-electric
  • ruby-mode
  • enh-ruby-mode
  • ruby-test-mode
  • ruby-tools
  • robe-mode
  • highlight-indentation

    Did you use sublime before, this package provide the same thing like sublime guideline indentation

    • highlight-indentation-mode displays guidelines indentation (space indentation only).
    • highlight-indentation-current-column-mode displays guidelines for the current-point indentation (space indentation only).

    color configuration

    • (set-face-background ‘highlight-indentation-face “#e3e3d3”)
    • (set-face-background ‘highlight-indentation-current-column-face “#c3b3b3”)
  • dash

    A modern list api for Emacs. No ‘cl required

  • rubocop

    A simple Emacs interface for RuboCop which is a Ruby static code analyzer.

  • simple-httpd
  • textmate

    This minor mode exists to mimick TextMate’s awesome

  • yasnippet
  • switch-window
  • weibo.emacs
  • smartparens
  • eproject
  • etags-select
  • ;; etags-extension
  • slime
  • ctags
  • rcodetools
  • anything
  • ;; anything-etags
  • emacschrome
  • emacs-http-server
  • auto-complete
  • auto-complete-css
  • auto-complete-emacs-lisp
  • auto-complete-extension
  • auto-complete-etags
  • auto-complete-clang
  • auto-complete-yasnippet
  • rails-el
  • yari
  • zencoding-mode

    letting you write HTML based on CSS selectors.

    C-j: place point in a zencoding snippet and press C-j to expand it C-c C-j: you’ll transform your snippet into the appropriate tag structure.

  • gnuplot-mode
  • ;; magithub
  • nav
  • ;; twittering-mode
  • rvm
  • flymake-haml
  • flymake-sass
  • flymake-coffee
  • emacs-w3m
  • scss-mode
  • color-theme
  • powerline

    powerline theme for emacs modeline

  • dash-at-point

    dash integrate for emacs to query program language api keybinding - C-c d

  • skewer-mode

    live web development with Emacs

    • start
      • M-x run-skewer to attach a browser to Emacs
      • From a js2-mode buffer with skewer-mode minor mode enabled, send forms to the browser to evaluate
    • js evaluating expressions
      • C-x C-e: Evaluate the form before the point and display the result in the minibuffer. If given a prefix argument, insert the result into the current buffer.
      • C-M-x: Evaluate the top-level form around the point.
      • C-c C-k: Load the current buffer.
      • C-c C-z: Select the REPL buffer.
    • css
      • C-x C-e: Load the declaration at the point.
      • C-M-x: Load the entire rule around the point.
      • C-c C-k: Load the current buffer as a stylesheet.
    • html
      • C-M-x: Load the HTML tag immediately around the point.
  • web-mode
  • jump-char

    Navigate by char

    M-m jump-char-farword <char> move to the next match in the current direction. ; next match forward (towards end of buffer) , next match backward (towards beginning of buffer) C-c C-c invoke `ace-jump-mode’ if available

  • ace-jump-mode

    help you to move the cursor within Emacs,ou can move your cursor to ANY position ( across window and frame ) in emacs by using only 3 times key press.


  • exec-path-from-shell
  • adaptive-wrap
  • wrap-region

    Wrap Region is a minor mode for Emacs that wraps a region with punctuations.. For “tagged” markup modes, such as HTML and XML, it wraps with tags.

  • expand-region

    Expand region increases the selected region by semantic units. (global-set-key (kbd “C-=”) ‘er/expand-region)

    (pending-delete-mode t)

  • multiple-cursors


    (global-set-key (kbd “C-S-c C-S-c”) ‘mc/edit-lines) (global-set-key (kbd “C->”) ‘mc/mark-next-like-this) (global-set-key (kbd “C-<”) ‘mc/mark-previous-like-this) (global-set-key (kbd “C-c C-<”) ‘mc/mark-all-like-this)

    To get out of multiple-cursors-mode, press <return> or C-g.

  • * maxframe

    instead of buildin toogle-frame-fullscreen

  • multi-term
  • es-lib
  • grizzl
  • s
  • project-explorer
  • flx

    Fuzzy matching for Emacs … a la Sublime Text.

  • projectile

    Projectile is a project interaction library for Emacs. Its goal is to provide a nice set of features operating on a project level without introducing external dependencies

    C-c p f (command-p) projectile-find-file C-c p s (command-b) projectile-switch-project

    complete keybinding

  • pkg-info
  • recentf-ext
  • tabbar
  • rainbow-mode Colorize color names in buffers
  • rainbow-delimitewrs

    highlights parentheses, brackets, and braces according to their depth. Each successive level is highlighted in a different color.

  • highlight-indentation
  • idle-highlight-mode

    buildin highlight symbol C-x w . , M-s h . idle-highlight-mode sets an idle timer that highlights all occurences in the buffer of the word under the point.

  • findr
  • enclose
  • drag-stuff
  • calfw
  • ac-js2

    context sensitive auto-completion for Javascript in Emacs using js2-mode’s parser and Skewer-mode

    navigation: placing the cursor on foo, bar or baz and executing ac-js2-jump-to-definition or M-. will take you straight to their respective definitions. Executing M-, will jump you back to where you were.

    ac-js2-expand-function that will expand a function’s parameters bound to C-c C-c. Expansion will only work if the cursor is after the function.

  • ag
  • popup
  • multiple-cursors
  • google-maps
  • google-contacts
  • color-theme-solarized


I mainly use org as a note tools, so have many specticular configuration to org, such as customize tags, default templates…