Indentation falls through to Emacs Lisp inside a binding vector
This commit is contained in:
parent
693661c4dd
commit
394b656a68
18
DISCUSS.md
18
DISCUSS.md
@ -269,3 +269,21 @@ Questions it opens:
|
||||
different feature — closer to a HUD than a debugger — and worth not conflating.
|
||||
- **Whether it belongs in the break buffer at all**, or in its own window that is useful while the program is *running*,
|
||||
which is arguably where a game developer wants it.
|
||||
|
||||
## 9. Indentation is wrong inside a binding vector
|
||||
|
||||
Reported against the `let` in `sand.flan`'s `settle`: the second and later bindings indent one column too far.
|
||||
|
||||
**Cause, found by reading `flan-mode.el`.** `flan-indent-function` looks at the head of the *enclosing* form and, when
|
||||
it is one of Flan's body forms (`defn`, `let`, `if`, `while`, `until`, `dotimes`, `match`, `do`, `loop`, `defer`),
|
||||
indents one past the open paren. Inside a `let`'s binding *vector* the enclosing open is the `[`, and the symbol after
|
||||
it is the first binding's **name** — never a body form — so the check fails and it falls through to Emacs's generic
|
||||
`lisp-indent-function`, which treats the vector as a function call and aligns continuation lines under the first
|
||||
*argument* rather than under the first *binding*.
|
||||
|
||||
**What it is built on:** Emacs's built-in `lisp-indent-function`, with that one override. Not `clojure-mode`, which is
|
||||
where the missing piece lives — `clojure-mode` special-cases binding vectors and aligns them as pairs.
|
||||
|
||||
The fix is a binding-vector case in `flan-indent-function`: when the enclosing open is `[` and the form containing it is
|
||||
a binding form, align to the column of the first binding. Worth checking the other bracket users at the same time —
|
||||
`defn` parameter lists and `restart-case` clause parameters have the same shape.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user