Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzy indentation in Clojure #753

Closed
Raynes opened this issue Aug 28, 2012 · 0 comments
Closed

Fuzzy indentation in Clojure #753

Raynes opened this issue Aug 28, 2012 · 0 comments

Comments

@Raynes
Copy link
Contributor

Raynes commented Aug 28, 2012

If you write a function, it looks like this:

(defn foo [x]
  (+ x x))

However, Clojure has macros, so defn isn't special at all. People define their own def functions all the time. An example is the popular web framework, Compojure:

(defroutes foo
  (GET "/" [] "Hello!"))

But codemirror tries to indent the above like so:

(defroutes foo
           (GET "/" [] "Hello World!"))

To solve this problem, the various editors for Clojure implement a rule where anything starting with def and with are indented in the same way as a defn form is indented. The Emacs mode and Vim plugin both do this. In Emacs, it is on by default (which I think is correct as this is the widely accepted convention) and it is optional in Vim.

It'd be great to have this in codemirror too. If it is on by default, even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants