Repository navigation
Conversation
The error had the whole request in it, which for a request carrying code means all of that code in the echo area and *Messages*, and with a request that sends a whole file, all of the file.
cider-ns-clean (C-c M-n c) takes over from clj-refactor's cljr-clean-ns. The REPL's cider/clean-ns op reads the code after the ns form, without loading it, and says which libspecs, aliases, referred names and imports go unused. CIDER removes exactly those, so the rest of the ns form stays as it's written, comments included, where refactor-nrepl reprints the whole form. Then cider-ns-edit-actions apply, as after any other edit to the ns form. It's never automatic, since removing a require the code needs is the worst thing an ns command can do, and requires with no alias and nothing to refer, which tend to be there for their side effects, never go. Called from Lisp, as from before-save-hook, it does nothing without a REPL that has the op and reports problems in the echo area, so saving goes on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cider-ns-clean(C-c M-n c) replaces clj-refactor'scljr-clean-ns, using thecider/clean-nsop from clojure-emacs/cider-nrepl#1063. It removes only what the op reports and leaves the rest of thensform as it's written, comments included, instead of reprinting it. It's a command rather than an option; the docs show how to run it on save.A timed-out sync request also stops putting the whole request in its error, which for this op meant the whole file.