spacemacs

Epidiah Ravachol 2023-04-01T23:26:37.212379Z

I've got another newbie question here. In Clojure-mode using Which-Key, pressing , r brings up the "refactor" menu. There are a bunch of prefixes like "hotload," "introduce/inline" and "move" that don't appear to do anything. When I try them, I get a message from Which-Key that says there are no keys to show. Keying in , ? explains this:

The package clj-refactor is disabled by default.
To enable it, add the following variable to the clojure layer
in your Spacemacs configuration:

  dotspacemacs-configuration-layers
  '(...
    (clojure :variables
             clojure-enable-clj-refactor t)
    ) 
My question is, if I want to leave clj-refactor disabled, for now, is there a way to remove these key maps from the Which-Key menu? I don't think I had them there before, but I can't think of what I did to make them appear.

Epidiah Ravachol 2023-04-02T13:08:03.580309Z

Huh, I thought it was just me. Or rather, I didn't notice it until late last night and because I'm still very new at this, I assumed it was because of some setting I accidentally set. But scrubbing my .spacemacs and starting fresh with just clojure-mode installed, I see the empty options are still there. So maybe it's been that way all along?

Drew Verlee 2023-04-02T03:34:28.879719Z

I assume that binding will go away if you change that t to nil.

Drew Verlee 2023-04-02T03:35:00.892329Z

err maybe it doesnt. odd

practicalli-johnny 2023-04-03T12:20:40.952669Z

The code that sets up the prefix names (sub-menu names) seems strange https://github.com/syl20bnr/spacemacs/blob/develop/layers/%2Blang/clojure/packages.el#L392-L450 It shouldnt make any difference to the refactor bindings if lsp or cider is the backend. The only condition should be if clj-refactor is enabled. When clj-refactor is enabled, then the prefix names and key bindings should be included. I tried hacking around this and its easy enough to drop the clj-refactor specific prefixes, but then the names dont show when clj-refactor is enabled 😞 I need to go to Emacs Lisp school 😉

practicalli-johnny 2023-04-03T12:23:13.214949Z

The prefixes that should be included for clojure-mode are

'(("mra" . "add")
               ("mrc" . "cycle/clean/convert")
               ("mrr" . "remove/rename/replace")
               ("mrs" . "show/sort/stop")
               ("mrt" . "thread")
               ("mru" . "unwind/update")
               )
Everything else should only be added if clojure-enable-clj-refactor t is set

1
Epidiah Ravachol 2023-04-03T12:31:46.552409Z

Thanks! I ended up adding clj-refactor anyway while experimenting in search of the cause of all this and just left it in. I was only really avoiding it because the clojure-mode documentation seemed to be warning against it. But this is very helpful and could save me some aggravation if clj-refactor turns out not to be a good fit.

practicalli-johnny 2023-04-03T13:04:45.473819Z

Clj-refactor did loose a maintainer for quite a while. I think it's now being maintained by the cider maintainer now and has been brought up to date (or at least enough to not cause so many issues) In the meantime many of the refactoring tasks had already moved to closure mode and closure LSP also provides a lot of refactoring so there's quite a bit of redundancy across all three tools

practicalli-johnny 2023-04-03T13:09:09.703779Z

I rarely use any of these tools myself