oakmac / oakmac/standard-clojure-style-js

Question: Rule 3 editor support (Emacs)

Open
#194 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
137
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Hi!

Background:

We just reformatted our codebase using Standard Clojure Style.

I've configured my Emacs to indent with fixed indentation, as instructed here. This works fine, however, it does not recognize Rule 3.

In addition, I use aggressive-indent-mode which aggressively indents the code so that it's correctly indented all the time. I quite like it.

So the problem is that since Emacs doesn't recognize Rule 3, given I have the following code:

(foo bar
     baz
     quaz)

and I add an extra empy line after baz, I get this:

(foo bar
  baz

  quaz)

The output is, of course, fine and correct according to Standard Clojure Style, however, it just creates unnecessary diffs to commits. (And to avoid unnecessary diffs is one reason to use a formatter in the first place, IMO)

What I'd hope for is an Emacs indentation configuration that would understand Rule 3, and produce this:

(foo bar
     baz

     quaz)

Question:

This Issue is not a bug, but a question: Has anyone managed to configure Emacs so that it supports Rule 3?

Contributor guide

No contributing guide indexed for this repository

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

Start with the linked fixed-indentation configuration post and the behavior of clojure-mode with aggressive-indent-mode. Determine whether Emacs can preserve Rule 3 after blank lines, then document a working configuration or clearly record the limitation and any relevant upstream setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, emacs
Domain
tooling
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.