Fork me on GitHub
#emacs
<
2020-12-07
>
pcj00:12:30

Hello everyone 🙂 Is there an easy way to change the indentation of a user macro in clojure mode? I have code that looks something like this:

(|> 1
    |> inc
    |> inc)
But would like to have my indentation like so:
(|> 1
 |> inc
 |> inc)
Looking at https://github.com/clojure-emacs/clojure-mode#indentation-of-macro-forms it only seems that one can define indentation for built-in macros... but maybe I'm missing something?

ericdallo01:12:02

I think you can use something like:

(define-clojure-indent
    (your-macro 'defun))

ericdallo01:12:05

define-clojure-indent is a elisp macro, that's why accepts anything that may be a clojure macro like your-macro

ericdallo01:12:36

or

(define-clojure-indent
    (your-macro 1))

pcj02:12:31

Thank you for the response! Trying

(define-clojure-indent
  (|> 'defun))
changed the indentation 🙂 Only problem is is that it's 1-off from being what I'd like it to be 😞
(|> N
  |> inc
  |> inc)
The way I want it is a weird case and I doubt much clojure code would be styled like that (and I am only doing it for fun).