Doom Emacs

Read a form

November 21, 2026

First, recall

Two days have passed since lesson 1. Answer from memory. Do not open the help reference.

From lesson 10 of 3 answered
1. You see add-hook in your config and want its list of arguments. Which key?
2. Your config sets scroll-margin to 16. How do you confirm the value that Emacs has now?
3. Before you make an error occur again, you want Emacs to give a backtrace. Which key?

One rule

Emacs Lisp code is made of lists in parentheses. The introduction to Emacs Lisp gives the rule: when Emacs evaluates a list, the first item is a function, and the other items are its arguments.

(+ 2 3)

The function is +. The arguments are 2 and 3. The result is 5. In this course, a list that you can evaluate is a form.

Emacs evaluates each argument before it calls the function. What an argument gives depends on its type.

You writeEmacs givesWhy
16 or "~/org/"the same number or stringNumbers and strings are their own value.
scroll-margin16A name without a quote is a variable. Emacs gives its value.
'scroll-marginscroll-marginThe quote says: do not evaluate. Give the name.
(+ 2 3)5A list is a call to a function.

The quote is the part that matters most in a config. With a quote, Lisp takes the text as written and does not run it. You use it when a function needs a name, not the value behind the name.

Two forms from your config

Line 65:

(setq scroll-margin 16)

setq gives a value to a variable and returns that value. It is a special case: it does not evaluate the variable name, so you write no quote there. It takes its arguments in pairs. That is why lines 24 and 25 set two fonts in one setq.

Line 35:

(setq doom-theme 'catppuccin)

The value has a quote. Without the quote, Emacs would look for a variable with the name catppuccin. The theme is identified by its name, so you pass the name.

Line 179

(add-hook 'rfc-mode-hook #'display-line-numbers-mode 'relative)

Read it with the rule. The function is add-hook. There are three arguments.

  1. 'rfc-mode-hook: the name of a hook. A hook is a variable that holds a list of functions. Emacs calls them when something occurs, here when a buffer enters rfc-mode.
  2. #'display-line-numbers-mode: the name of a function. #' is a quote for functions. It gives the name without evaluation, and it tells Emacs that the name is used as a function.
  3. 'relative: the name relative, in the position of the argument depth.

The Elisp manual says that depth is a number from -100 to 100 for the position of the function in the hook, and that a symbol there counts as 90. So your line puts the function near the end of the hook. It does not select relative numbers. Line 39 does that for all buffers. The argument is harmless, but it says something that is not true. You will remove it in the drill.

Drill

Use SPC ;. It runs eval-expression: you type one form, and Emacs shows the result at the bottom of the screen (Doom Getting Started). Predict each result first.

Evaluate, then repair · about 12 min0 of 7 matched
  1. 1
    Evaluate (+ 2 3).
    First, predict: the result.
  2. 2
    Evaluate scroll-margin, then evaluate 'scroll-margin.
    First, predict: the two results. They are different.
  3. 3
    Evaluate (scroll-margin).
    First, predict: what Emacs does with the first item of a list.
  4. 4
    Evaluate relative, with no quote.
    First, predict: is there a variable with this name?
  5. 5
    Evaluate (setq scroll-margin 2). Scroll in a long file. Then evaluate (setq scroll-margin 16).
    First, predict: what setq shows, and what changes when you scroll.
  6. 6
    Open config.el at line 179. Put the cursor on the space before 'relative. Type d t ). Save the file.
    First, predict: the text that d t ) removes, and the line that stays.
  7. 7
    Read line 179 aloud in this form: "Call the function ... with the arguments ... and ...". Then do the same for line 35.

Recall

Recall0 of 4 answered
1. What does 'scroll-margin give when you evaluate it?
2. What does (scroll-margin 16) give?
3. In (setq doom-theme 'catppuccin), why does catppuccin have a quote?
4. What does the third argument of add-hook control?

The short form of this lesson is in the Elisp reading reference.