Emacs: How to Edit Lisp Code

By Xah Lee. Date: . Last updated: .

This page shows you how to edit lisp code with plain emacs efficiently.

Highlight Brackets: show-paren-mode

Emacs: Highlight Brackets ()[]{}

Insert Brackets by Pair

Emacs: electric-pair-mode

You should ALWAYS insert brackets by pair.

Delete Brackets by Pair

Emacs: Delete Brackets ()[]{} by Pair

You should ALWAYS delete brackets by pair.

Move Cursor to Bracket

Emacs: Move Cursor to Bracket/Quote

It's critical to have keys that move cursor to previous opening bracket and next closing bracket.

Navigate Lisp Code as Tree

Emacs: Navigate Lisp Code as Tree

You can move cursor to brackets in such way as navigating a tree.

This is less useful than the freely moving to any bracket.

Select Lisp Expression by Unit

Alt+x mark-sexpCtrl+Alt+Space】 to select a complete parenthesized expression. Your cursor must be on the left bracket.

To select a complete sexp, type 【Ctrl+Alt+】 (backward-up-list) then 【Ctrl+Alt+Space】.

Xah Emacs Lisp Mode

You may try my elisp mode. It provides better syntax coloring, and lots abbrev and function parameter templates.

Emacs: Xah Emacs Lisp Mode

Emacs Lisp Basics

  1. Elisp Basics
  2. ELisp Text-Processing Overview
  3. Elisp Examples
  4. Evaluate Elisp Code
  5. Doc Lookup
  6. Search Doc
  7. How to Edit Lisp Code

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboards for Emacs


Emacs Lisp