clojure-emacs / clojure-emacs/clojure-mode
Reader conditional confuses indentation
- Dominant language
- Emacs Lisp
- Stars
- 1k
- Forks
- 249
- PR merge metrics
- No merged PRs in 30d
Description
## Expected behavior
```clj
(reify
Object
#?@(:clj
[(equals
[this other])
(hashCode
[_]
(hash 1))]
:cljs
[(toJSON
[this]
(throw (ex-info "error" {})))
IEquiv
(-equiv
[this other]
true)]))
```
## Actual behavior
```clj
(reify
Object
#?@(:clj
[(equals
[this other]) ; <------
(hashCode
[_]
(hash 1))]
:cljs
[(toJSON
[this] ; <------
(throw (ex-info "error" {})))
IEquiv
(-equiv
[this other]
true)]))
```
## Steps to reproduce the problem
`(setq clojure-indent-style 'align-arguments)`
(But the problem is the same with `'always-align`.)
Paste in a buffer and indent.
(C-x h TAB)
## Environment & Version information
### clojure-mode version
`M-x
clojure-mode-display-version`
clojure-mode (version nil)
When checking in packages:
20220418.2015
### Emacs version
28.1
### Operating system
Ubuntu 18.04.6 LTS
Contributor guide
Research direction
Reproduce the indentation difference in clojure-mode using align-arguments and always-align, then trace the indentation handling for the #?@ reader conditional. Confirm the fix against the supplied reify example so both Clojure and ClojureScript branches match the expected indentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, emacs-lisp
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100