Fork me on GitHub
#emacs
<
2022-07-06
>
oskarkv11:07:45

Does anyone know if there is a way to get macros defined with macrolet to get indented like macros (or with a specific special indent style)? I want the indentation below, not (apply whatever args) lined up with x. (I'm using CIDER, if that matters.) Note, I want whatever I define with macrolet to always get indented like a macro (meaning second line indented 2 spaces, regardless of what's on the first line), whatever its name.

(macrolet [(wrapper [a b c]
             do-something)]
  (defn some-function [args]
    (wrapper x y
      (apply whatever args))))

Cora (she/her)14:07:04

you can play with define-clojure-indent to set the indentation for different things

Cora (she/her)14:07:09

(define-clojure-indent
    (defroutes :defn)
    (GET 2)
    (POST 2)
    (PUT 2)
    (DELETE 2)
    (HEAD 2)
    (ANY 2)
    (OPTIONS 2)
    (PATCH 2)
    (context 2)
    ;; (ns 1) ;; default ns indentation
    (ns '(1 0)) ;; intellij cursive's indentation of ns
    )

oskarkv19:07:44

I know about define-clojure-indent, but I was hoping that I could get clojure-mode or CIDER to indent whatever I define with macrolet to get indented as macros, i.e. with the second and following lines indented 2 spaces no matter what's on the first line (with the macro name). With define-clojure-indent, as far as I know, I can only define the indentation for specified names, right?

Cora (she/her)20:07:55

yeah, it seems like that's the case, that you need to define it yourself

Cora (she/her)20:07:04

clojure-lsp has some formatting stuff but I don't know if it's hooked in as deeply as cider and clojure-mode

Cora (she/her)20:07:38

but I'm not sure how to teach it about macros and what makes macros

Cora (she/her)20:07:13

I know clojure-lsp uses clj-kondo under the hood, I wonder if you could use lsp-mode's indentation and then use clj-kondo's hooks to extend it to support your macro https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md

Cora (she/her)20:07:11

looks like it'll use the clj-kondo hooks in the project and so if you write a hook for it you can hook in lsp indentation and you'll be good

kingcode15:07:09

Is anyone here familiar with Chemacs2?

Cora (she/her)18:07:42

not familiar but it looks super interesting

kingcode21:07:56

I jave always been afraid to tinker and learn emacs in depth because of the awkardness of switching contents of .emacs.d, so this looks perfect, but I’m having trouble making it work with Emacs 27.2, but it’s fine with Emacs 29. Will try it out with 28.

kingcode23:07:03

Although, Emacs 29 does provide a startup option, —init-directory which essentially does the same thing. But it may be a while before a release 29, and so 28 may be the best option in unless I can figure out why I am having the problem.

Cora (she/her)23:07:59

isn't emacs 28 when they first released early-init.el?

Cora (she/her)23:07:15

iirc chemacs2 relies on that

kingcode00:07:32

I opened an issue and got a reply from @U07FP7QJ0 that it should work for emacs 27+. Yes indeed, emacs 27 does handle early-init.el. For now it works fine with emacs 28.1, which is a stable release. Will test it some more and install it.

Cora (she/her)00:07:01

28 is really nice

kingcode00:07:06

Awrigh’! Looking forward to emacs the 28.1 way :)

Cora (she/her)01:07:23

you can compile things to native code in 28.1

Cora (she/her)01:07:33

doom emacs does it for you automatically, it'a amazing

kingcode01:07:26

I have heard good things about doom. I prefer to keep it light to learn more easily though. Cheers.

Benjamin05:07:45

Chemacs works great recommend

Konrad Claesson16:07:50

Does anyone know how to increase the JVM heap used by cider?

dpsutton16:07:38

CIDER does not dictate the jvm heap. It just starts up your project. Configure it as you normally would. If using the clojure command line tools you will need to put the :jvm-args in an alias and then ensure that CIDER also uses that alias (the one caveat to “CIDER doesn’t dictate”)

Alex Miller (Clojure team)16:07:46

if using clj, you can instead do -J-Xmx512m or whatever

Alex Miller (Clojure team)16:07:00

probably easier than making and using an alias

dpsutton16:07:10

ah good point. Let me check if CIDER has a seam for that kind of thing

dpsutton17:07:39

i think you can setq or use dir-locals with cider-clojure-cli-global-options set to “-J-Xmx512m” as @alexmiller has pointed out here

dpsutton17:07:15

yeah there’s an example in the docs

(setq cider-clojure-cli-global-options "-J-XX:-OmitStackTraceInFastThrow")

Konrad Claesson17:07:09

Adding

:aliases {:dev {:jvm-opts ["-Xmx32g"]}}
to deps.edn did the trick