spacemacs

Brian Beckman 2022-04-29T01:19:14.356159Z

? Spacemacs + clj-refactor problems ? [SOLVED; ty @didibus and @jr0cket] Some documentation says that installing the clojure layer in Spacemacs automatically loads clj-refactor, but none of the cljr-blahblah functions show up in Meta-X. Then I read I should do (clojure :variables clojure-enable-clj-refactor t)) in the layer spec, but that sends Spacemacs into death-recovery mode. Then I tried installing the clj-refactor package in the Spacemacs place dotspacemacs-additional-packages and doing

(require 'clj-refactor)
(defun my-clojure-mode-hook ()
  (clj-refactor-mode 1)
  (yas-minor-mode 1)
  (cljr-add-keybindings-with-prefix "C-c C-m")
  )
(add-hook 'clojure-mode-hook #'my-clojure-mode-hook) 
and various permutations of that in dotspacemacs/user-config, but still none of the cljr-blahblah functions show up. any clues for me?

practicalli-johnny 2022-04-29T08:41:13.378639Z

The official guide to the Clojure layer is at https://develop.spacemacs.org/layers/+lang/clojure/README.html#enabling-sayid-or-clj-refactor Yes, @didibus is correct that clj-refactor and other features are optional on the layer. Any http://www.spacemacs.org layer documentation is likely to be several years out of date, so the http://develop.spacemacs.org version should be used. develop branch has been the default branch for a long time now, and the defacto branch used for many years.

πŸ‘ 1
practicalli-johnny 2022-04-29T08:42:36.683169Z

You could also refer to https://practical.li/spacemacs/ which uses the develop branch of Spacemacs

πŸ‘ 1
2022-04-29T05:05:40.565579Z

All I have is:

(clojure :variables
              clojure-backend 'cider
              clojure-enable-clj-refactor t
              clojure-enable-linters 'clj-kondo)
And I'm on the develop branch, and it works

πŸ‘ 1
Drew Verlee 2022-04-29T05:12:42.544279Z

And for the weirdest bug i have ever come across. simple moving my mouse over this variable causes emacs to to use 100% cpu and crash

practicalli-johnny 2022-04-29T08:47:23.405559Z

I wonder if its Emacs that is using the CPU or is Emacs blocked by a process it shelled out to that is using the CPU? e.g. clojure-lsp ? Perhaps look at the spawned processes as the mouse moves over that name https://practical.li/spacemacs/install-spacemacs/troubleshooting.html#issues-with-spawned-processes If Emacs lsp-ui has the docs mouse over docs enabled, you may have found a bug with lsp-ui or possibly clojure-lsp

πŸ‘€ 1
practicalli-johnny 2022-05-03T19:59:25.740959Z

I've just sent the CPU to over 100% after typing in comment-selection which should have been a snippet that expanded, but it wasn't recognised as a snippet and now Emacs is keeping my laptop warm... TAB or j with the cursor over comment sends the Emacs process into a frenzy... C-g stops what ever process is using all the cpu...

practicalli-johnny 2022-05-03T20:02:54.730489Z

Interesting. Logging the commands I get C-g pupo/close-window which seems to suggest that purpose-popwin is trying to do something. Could the auto-completion be using purpose-powin to draw the popups and somehow be getting stuck trying to do something?

ericdallo 2022-05-03T20:04:23.452359Z

never heard of that package/function πŸ˜‚ which package calls it in the stack? lsp-mode/clojure-mode etc

practicalli-johnny 2022-05-03T20:06:59.166629Z

There is a backtrace here https://gist.github.com/practicalli-john/278b8d8ec30deab3fb162405dd2c98ad

practicalli-johnny 2022-05-03T20:07:13.957639Z

line 38 has an lsp process

ericdallo 2022-05-03T20:08:03.056819Z

still, it seems to come from clojure--looking-at-non-logical-sexp , clojure-mode

practicalli-johnny 2022-05-03T20:09:54.588429Z

I can instantly fix the issue by running lsp-workspace-shutdown

practicalli-johnny 2022-05-03T20:10:07.781979Z

but then I dont have LSP anymore and I am sad 😞

ericdallo 2022-05-03T20:11:14.823919Z

probably lsp is trying to do something that under the hood end up calling a clojure-mode function which causes that

practicalli-johnny 2022-05-03T20:11:20.446569Z

seems like a case of clojure-mode conflicting with clojure-lsp in some strange way as it just doesnt happen with lsp disabled

ericdallo 2022-05-03T20:11:23.553399Z

so the fix would be on clojure-mode still

ericdallo 2022-05-03T20:12:24.376809Z

yeah, it's the lsp hover feature, which tries to color the token using the major mode, in this case clojure-mode, which seems that function has some performance regex issue

ericdallo 2022-05-03T20:12:41.870699Z

if you manage to repro calling that function manually, you could open a issue on clojure-mode

practicalli-johnny 2022-05-03T20:22:34.221659Z

Is that the hover feature for docs, or for auto-complete (or are they the same thing)

ericdallo 2022-05-03T20:22:52.371249Z

docs

practicalli-johnny 2022-05-03T20:26:29.064069Z

Ah yes, if I disable docs popup completely then I do not get the lockup with lsp running. Initially I had disabled the docs popup for the cursor but not for mouse, so a little strange ciojure-mode is causing a lockup. I will try and see if I can figure out something meaningful to report on clojure-mode Thank you.

πŸ‘ 1
ericdallo 2022-05-03T20:28:53.588309Z

yeah, probably the issue is that the hover docs show markdown clojure code, and to color that markdown we call the major mode which knows how to color it, in this case clojure-mode

practicalli-johnny 2022-05-03T21:25:34.103469Z

Hmm, I has assumed there wouldnt be any docs for the piece of text by itself, i.e. comment-seperatoror (spelt incorrectly on purpose) yet lsp seems to be trying to font lock the markdown for it. Is this normal?

lsp--fontlock-with-mode("
clojure\ncomment-separatoror\n
\n\n----\n\n*[/home/..." lsp--render-markdown)
  lsp--render-string("
clojure\ncomment-separatoror\n
\n\n----\n\n*[/home/..." "markdown")
  lsp--render-element(#<hash-table equal 2/2 0x1591b67bd835>)
  #f(compiled-function (contents server-id) #<bytecode 0x7a9334e0f6d7b8a>)(#<hash-table equal 2/2 0x1591b67bd835> clojure-lsp)
  apply(#f(compiled-function (contents server-id) #<bytecode 0x7a9334e0f6d7b8a>) #<hash-table equal 2/2 0x1591b67bd835> clojure-lsp nil)
  lsp-clients-extract-signature-on-hover(#<hash-table equal 2/2 0x1591b67bd835> clojure-lsp)

practicalli-johnny 2022-05-03T21:26:17.834369Z

Oh, it seems like lsp is rendering docs for text, although if I change the text and hover over with the mouse the doc is for the previous text.. very strange..

practicalli-johnny 2022-05-03T21:29:56.571879Z

This is quite curious. Originally the text was comment-separatoror and then I change it to fish-and-chips and when I hover over with the mouse I get a doc with the previous text.

ericdallo 2022-05-03T21:31:42.244649Z

Sounds like outdated analysis from clojure-lsp, although not related to the performance issue

practicalli-johnny 2022-05-03T21:44:25.973019Z

I think its because the backtrace has stopped everything in Emacs. I guess that is how it works, first time I've tried to use it in a while. I've had to reboot emacs.

πŸ‘ 1
ericdallo 2022-05-01T15:32:02.935649Z

I don't think it's LSP related but you never know πŸ˜‚ I suspect it could be related to clojure-mode or something, I suggest you toggle-debug-on-quit and when everything freezes or cause the issue hit C-g to get a stack where emacs was

jacob.maine 2022-05-01T18:53:06.108519Z

I’ve had freezes too, always when interacting with functions whose name starts with β€œcomment”! For me, I don’t think it was on hover, though I can’t remember perfectly. I’d also be surprised if it’s clojure-lsp, since clojure-lsp operates primarily on tokens (i.e. the full function name), not parts of tokens. But you never know.

☝️ 1
Drew Verlee 2022-04-29T05:13:19.688859Z

i'm going to see if re-naming it does anything, just bc i have no idea what better to do.

Drew Verlee 2022-04-29T05:16:23.875049Z

yes. re-naming it means it doesn't crash. I can reliable crash emacs just with that specific name.

Drew Verlee 2022-04-29T05:17:01.277049Z

hmmmm

Drew Verlee 2022-04-29T05:17:09.547009Z

maybe bc it starts with "comment"?