clojure-emacs / clojure-emacs/clojure-mode

Alignment bug with comments/forms following a closing delimiter

Open
#525 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Emacs Lisp
Stars
1k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

## Expected behavior
`M-x clojure-align` on the following forms should be a no-op:
```clojure
{:a [123
456
789] :b 10}

(cond foo {:bar 1 ; initialize the Bar
:baz 2} ; and the Baz
quux {})

```
## Actual behavior

The second "column" is pushed farther and farther to the right every time `clojure-align` is called.

```clojure
{:a [123
456
789] :b 10}

=>

{:a [123
456
789] :b 10}

=>

{:a [123
456
789] :b 10}

=>

{:a [123
456
789] :b 10}
```
## Steps to reproduce the problem

Execute `clojure-align` on any hashmap or function defined in `clojure-cond-align-forms`, which has a symbol or comment following a closing delimiter that is on a different line from its opening delimiter:

```clojure
;; this is fine
{:a [1 2] ; comment
}

;; this is also fine
{:a [[1
2] ; comment
3]
}

;; but not this
{:a [1
2
3] ; comment
}
```

The offending delimiter must belong to the second or greater "column" of the alignment

```clojure
;; This is alright
(are [x y z] (= (count y) x (inc z))
[100
200
300] 3 2)

;; This is not
(are [x y z] (= x (count y) (inc z))
3 [100
200
300] 2)
```

## Environment & Version information

### clojure-mode version information

*Include here the version string displayed by `M-x
clojure-mode-display-version`. Here's an example:*

```
clojure-mode (version 5.10.0)
```

### Emacs version

26.2

### Operating system

macOS 10.14

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.