Skip to content

Commit 2bc14d8

Browse files
authored
Merge pull request #384 from arichiardi/fix-lambda
Fix bug when passing lambda to define-clojure-indent, closes #383
2 parents 293da0e + f639b09 commit 2bc14d8

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
@@ -1090,6 +1090,9 @@ Implementation function for `clojure--find-indent-spec'."
10901090
(when (numberp method)
10911091
(setq method (list method)))
10921092
(pcase method
1093+
((pred functionp)
1094+
(when (= pos 0)
1095+
method))
10931096
((pred sequencep)
10941097
(pcase (length method)
10951098
(`0 nil)
@@ -1102,9 +1105,6 @@ Implementation function for `clojure--find-indent-spec'."
11021105
((or `defun `:defn)
11031106
(when (= pos 0)
11041107
:defn))
1105-
((pred functionp)
1106-
(when (= pos 0)
1107-
method))
11081108
(_
11091109
(message "Invalid indent spec for `%s': %s" function method)
11101110
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)