Emacs Lisp is the language that powers Emacs. Learning it transforms Emacs from "that text editor with strange shortcuts" into a programmable environment you can shape to fit your own workflow.
Beginner Friendly Practical Emacs-ThemedEmacs Lisp (often shortened to ELisp) is the programming language used to customize and extend Emacs.
Unlike most applications that expose limited configuration files, Emacs exposes nearly everything through Lisp.
This allows you to experiment, iterate, and build tools directly inside your editor.
Lisp uses prefix notation:
(+ 2 3)
Instead of:
2 + 3
Nested expressions become very natural:
(+ (* 2 3) 7)
Evaluation is central to Emacs Lisp.
| Shortcut | Purpose |
|---|---|
| M-: | Evaluate an expression from the minibuffer. |
| C-x C-e | Evaluate the expression before point. |
| M-x eval-buffer | Evaluate an entire buffer. |
(message "Hello from Emacs Lisp!")
42
3.14
"Hello, Emacs"
foo
t
nil
nil means both "false" and the empty list.
Variables store values.
(setq name "David")
(setq age 30)
Reading them is simple:
name
age
(message "Hello %s" name)
Functions are created with defun.
(defun say-hello ()
(message "Hello!"))
Functions can accept parameters:
(defun greet (person)
(message "Hello %s" person))
(greet "Alice")
This is where Emacs Lisp becomes special.
Add interactive and your function becomes available via M-x.
(defun my-command ()
(interactive)
(message "I can be called with M-x"))
Lists are everywhere in Lisp.
'(1 2 3)
| Function | Description |
|---|---|
| car | First element. |
| cdr | Rest of list. |
| cons | Add element to front. |
| length | Count elements. |
(car '(1 2 3)) ;; 1
(cdr '(1 2 3)) ;; (2 3)
(defun insert-date ()
(interactive)
(insert (format-time-string "%Y-%m-%d")))
(defun open-init-file ()
(interactive)
(find-file user-init-file))
(defun greet-user ()
(interactive)
(message "Welcome to Emacs!"))
foo is not the same as "foo".
| Concept | Example |
|---|---|
| Variable | (setq x 10) |
| Function | (defun hello () ...) |
| Interactive Command | (interactive) |
| List | '(1 2 3) |
| Evaluate Expression | C-x C-e |
| Eval Minibuffer | M-: |
Once you understand these fundamentals, you already know enough to start customizing Emacs and automating small tasks.