clojure-mode
clojure-mode copied to clipboard
cond-> indenting incompatible with common nested -> use case
Expected behavior
(-> obj
(cond->
pred1
(do-a-thing)
pred2
(do-another-thing)))
Actual behavior
(-> obj
(cond->
pred1
(do-a-thing)
pred2
(do-another-thing)))
Environment & Version information
clojure-mode version information
clojure-mode (version 5.5.2)
Emacs version
24.5.1
Operating system
Mac OS X El Capitan 10.11.3
autogenerated with https://github.com/MalloZup/doghub: issue inactive since 450 days. Please update the issue or close it
I guess this is basically the same as https://github.com/clojure-emacs/clojure-mode/issues/433
Setting its indent spec to 'defun solves the problem:
(define-clojure-indent (cond-> 1)) ; default:
(-> obj
(cond->
pred1
(do-a-thing)
pred2
(do-another-thing)))
(cond-> obj
pred1
(do-a-thing)
pred2
(do-another-thing))
(define-clojure-indent (cond-> 'defun)):
(-> obj
(cond->
pred1
(do-a-thing)
pred2
(do-another-thing)))
(cond-> obj
pred1
(do-a-thing)
pred2
(do-another-thing))
Doing (define-clojure-indent (as-> 'defun)) also sort of fixes #433:
(as-> 42 x
(+ x 1))
(as-> (very-very-very-long-expr-prob-shouldnt-be-here)
x
(+ x 1))
(-> 123
(+ 1)
(as-> x
(+ x 1)
(- 1 x)))