Fork me on GitHub
#emacs
<
2023-10-22
>
Stig Brautaset14:10:31

Is anyone else suffering from indent-region failing in some buffers sometime after startup? When I start Emacs it works correctly, but sometime later (I assume a hook runs?) I start getting this error in some modes:

Indenting region... 
apply: Wrong number of arguments: #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_16>, 2

Stig Brautaset14:10:39

I have not seen the problem in emacs lisp modes. I thought I had it narrowed down to modes where Eglot was enabled, but I'm no longer confident in that.

Stig Brautaset14:10:09

(Indenting a single line at a time works, it appears only indent-region is affected.)

jasonjckn21:10:02

that error looks familiar , but i can't remember what I did if anything to fix it. I use https://github.com/radian-software/apheleia to indent on save anyways, maybe that's a workaround for your issue.

jasonjckn21:10:50

I actually packaged up clojure-mode into a script, where the 'shbang' line is emacs, and call it from apheleia on-save, i can send it if you want it, but cljfmt, zstyle, etc much better options.

jasonjckn21:10:02

you might also want to try clojure-ts-mode, since it's a completely different indent engine / implementation of 'indent-region'

jasonjckn21:10:15

(setq load-prefer-newer t) can help avoid stale byte code, long shot though.

Stig Brautaset18:10:41

For unrelated reasons I did try clojure-ts-mode earlier, but reverted as there were some things I couldn't get to work properly. (Sadly my git history does not have good notes on why. I shall try again soon.) I'm doubtful that it will help, however, as the issue is not specific to Clojure mode, but also affects YAML mode and others. (Though not yet seen it in Emacs Lisp mode.)

jasonjckn18:10:31

never a bad time to switch to yaml-ts-mode too 😝 but yah, it’s not a root cause solution :)

😅 1
Stig Brautaset18:10:51

ISTR the issue I had was around automatically running eglot in these buffers? think_beret

Stig Brautaset18:10:34

Am willing to try the ts-modes, but haven't been able to apply yet. Need to schedule some time for that.

👍 1
jasonjckn18:10:29

add/move the #’eglot-ensure hook from prog mode , etc not sure i understand the question

jasonjckn18:10:40

treesit-auto will automatically remap all modes, yaml, etc

nice 1