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.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?
I assume that binding will go away if you change that t to nil.
err maybe it doesnt. odd
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 😉
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 setThanks! 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.
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
I rarely use any of these tools myself