Skip to content

Commit f639b09

Browse files
committed
Fix bug when passing lambda to define-clojure-indent, closes #383
1 parent 8ef7127 commit f639b09

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

clojure-mode.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,9 @@ Implementation function for `clojure--find-indent-spec'."
10121012
(when (numberp method)
10131013
(setq method (list method)))
10141014
(pcase method
1015+
((pred functionp)
1016+
(when (= pos 0)
1017+
method))
10151018
((pred sequencep)
10161019
(pcase (length method)
10171020
(`0 nil)
@@ -1024,9 +1027,6 @@ Implementation function for `clojure--find-indent-spec'."
10241027
((or `defun `:defn)
10251028
(when (= pos 0)
10261029
:defn))
1027-
((pred functionp)
1028-
(when (= pos 0)
1029-
method))
10301030
(_
10311031
(message "Invalid indent spec for `%s': %s" function method)
10321032
nil))))))

test/clojure-mode-indentation-test.el

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,17 @@ values of customisable variables."
164164
(ala/bala top
165165
|one)")
166166

167+
;; we can pass a lambda to explicitely set the column
168+
(put-clojure-indent 'arsymbol (lambda (indent-point state) 0))
169+
170+
(check-indentation symbol-with-lambda
171+
"
172+
(arsymbol
173+
|one)"
174+
"
175+
(arsymbol
176+
|one)")
177+
167178
(check-indentation form-with-metadata
168179
"
169180
(ns ^:doc app.core

0 commit comments

Comments
 (0)