clojure-emacs / clojure-emacs/clojure-mode

Indentation of `clojure.test/are`

Open
#548 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Emacs Lisp
Stars
999
Forks
249
PR merge metrics
No merged PRs in 30d

Description

Expected behavior

I was expecting clojure-mode's indentation to behave similar to cider-format and lein cljfmt. Is there some way to configure clojure-mode to indent the same way as cider-format?

Actual behavior

The macro clojure.test/are is indented one way with M-x cider-format (and lein cljfmt), but another way when using clojure-mode's indentation rules (with aggressive-indent-mode). The latter uses one space less than the former for the second argument to are (when it is on a new line).

Steps to reproduce the problem

The code is formatted as following using clojure-mode indentation:

(deftest are-test
  (are [x y]
      (= x y)
    1 1
    2 2))

And as following when using cider-format indentation (note the extra space on line 3):

((deftest are-test
  (are [x y]
       (= x y)
    1 1
    2 2))

Environment & Version information

clojure-mode version information
clojure-mode (version 5.11.0)
Emacs version
GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.12, cairo version 1.17.3) of 2019-11-26
Operating system

Arch Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the clojure.test/are examples using clojure-mode's indentation rules with aggressive-indent-mode, then compare them with M-x cider-format and lein cljfmt. Trace the clojure-mode indentation entry points and determine whether the extra space can be configured or made consistent; done means the displayed forms use matching indentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, emacs-lisp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.