emacs

Consider also joining #cider, #lsp and #inf-clojure, where most of the tool-specific discussions are happening.
pcj 2020-12-07T00:11:30.235500Z

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?

ericdallo 2020-12-07T01:18:02.235700Z

I think you can use something like:

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

ericdallo 2020-12-07T01:19:05.235900Z

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

ericdallo 2020-12-07T01:19:36.236100Z

or

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

pcj 2020-12-07T02:20:31.236400Z

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).