Emacs Cheatsheet


Emacs help

C-h b describe bindings
C-h f describe function
C-h v describe variable
C-h m describe mode


This list is very miscellanous, see http://orgmode.org

<s TAB inserts #+begin_src #+end_src section
<h TAB inserts #+begin_html … #+end_html
C-c . insert timestamp
C-c [ add file to Agenda
C-c ] remove file from Agenda
C-c C-e Org export. Brings up menu of options
C-c C-e t Insert Template into org doc
C-c C-e b Export to html and open page in browser
C-c C-e P Export and publish current project
C-c C-e F Export and publish current file
C-c C-e l Export as LaTex file
C-c C-e p Export as LaTex and process pdf
C-c C-e p Same as above … and open pdf
C-c c Org-capture
C-c cc Capture Calc III assignment
C-c cp Capture Probs and Stats HW.

Info Navigation

Navigating in the Emacs Info Reader

l back in history
p prev node
n next node
u up a level
<spc> scroll page then first sub-node at end of node

Emacs Macros

C-x ( start keyboard macro
C-x ) end keyboard macro
C-x e repeat last macro
M-n C-x e repeat last macro n times
M-x name-last-kbd-macro

More Emacs Commands

C-M ; comment-region
C-u C-M ; un-comment-region
C-M \ indent-region
M-PgUp scroll other window up
M-PgDn scroll other window down
M-% queery-replace
C-x f set-column-fill
M-q fill-paragraph

Dired Commands

m mark file
u unmark file
d mark file for deletion
x execute deletions
Q regexp search-replace in marked files
R rename marked files
Z compress file
~ mark all backup files for deletion
# mark all #'d files for deletion
O change owner
s toggle sorting by name/date

C-x C-q in Dired mode

also C-x C-q allows you to edit the dired directory as a file, and use
macros or string-replace to change lots of file names at once. Use C-c
C-c to save changes.

Emacs and Etags

M-. go to function
M-* after M-. go back to where you were.
M-x visit-tags-table add TAGS file for source
generate etags find . -name '*.java' xargs etags

Regular Expressions

Match a new line in the minibuffer

match a newline, \n, with C-j.
In the minibuffer, you have to type:

C-q C-j

The C-q quotes the following sequence C-j.

Match Parentheses

with ( or ). In emacs, it is reversed, use ( to match paren, and \( and \) to open and close a group.


  • use \\ to quote a character in elisp code
  • use a single backslash to quote in the minibuffer
  • Tramp

    with Tramp you use the same "write-file" command with keybinding C-x C-w and then give a remote ssh path as the file path

    save file to server C-x C-w
    use ssh path to save file remotely /ssh:username@yourserver.org:path/to/file

    JDE Keybindings

    C-c C-v z add any needed imports
    C-c C-v j add javadoc comment for class or method
    C-c C-v C-c compile
    C-c C-v C-r run app
    C-c C-v C-d debug app

    Magit Control

    Magit is an Emacs Mode for interacting with Git Repositories

    C-x g git status
    C-c C-c when in commit log: commit changes
    **Following commands work in git status buffer**
    s stage file at point
    u unstage file at point
    c open commit log
    P push master origin untracked file section
    i add file to ignore
    I add file to git/info/exclude
    k in unstaged: resets to head. ie discards changes
    k in untracked: deletes file
    <tab> in staged/unstaged: shows/hides diff of changes
    C-u P push master to ?: prompts for remote to push changes to
    l git log: hit <enter> on a commit to see changes
    = diff current with commit at point
    t create lightweight tag
    T create annotated tag
    x prompts for revision resets HEAD to it.

    Rinari Keybindings

    Rinari is an Emacs Mode for Ruby on Rails projects.

    C-c ; f c, rinari-find-controller
    C-c ; f e, rinari-find-environment
    C-c ; f f, rinari-find-file-in-project
    C-c ; f h, rinari-find-helper
    C-c ; f i, rinari-find-migration
    C-c ; f j, rinari-find-javascript
    C-c ; f l, rinari-find-plugin
    C-c ; f m, rinari-find-model
    C-c ; f n, rinari-find-configuration
    C-c ; f o, rinari-find-log
    C-c ; f p, rinari-find-public
    C-c ; f s, rinari-find-script
    C-c ; f t, rinari-find-test
    C-c ; f v, rinari-find-view
    C-c ; f w, rinari-find-worker
    C-c ; f x, rinari-find-fixture
    C-c ; f y, rinari-find-stylesheet

    Git Stuff

    git status ==> see status files
    git add init.el ==> add init.el to commit change log
    git commit ==> commit changes
    git remote add origin git remote add git@github.com:underhilllabs/[..].git
    git push origin master ==> push committed changes to git repository


    Textile is a markup language. I use org-mode markup more these days.

    h2. headline
    !>bossy.jpg! here is a picture of Bossy that will use align=right
    bq. a block quote
    <pre><code> for long code blocks use html tags

    wl Keybindings

    Wanderlist is an Emacs Mode for Reading Email.

    a or A replay to email under point
    d mark email for deletion
    x execute commands


    Add new comment

    Filtered HTML

    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
    • Lines and paragraphs break automatically.

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.
    By submitting this form, you accept the Mollom privacy policy.