-
Notifications
You must be signed in to change notification settings - Fork 112
Pass :always-return-ns-form true to clean-ns #558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass :always-return-ns-form true to clean-ns #558
Conversation
This allows for cleaning up whitespace even if there are no structural changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
Note that I went with always replacing the ns form even if there were no whitespace changes because there's no function for only extracting the current ns form for comparison
Unfortunately this doesn't seem ideal as it can needlessly touch
the underlying file - might be wasteful for misc other tools.
Note that there's defun cljr--maybe-eval-ns-form
. Jumping to definition from there you can find inspiration.
Cheers - V
CHANGELOG.md
Outdated
@@ -2,6 +2,8 @@ | |||
|
|||
## Unreleased | |||
|
|||
- `clean-ns` will reformat `ns` form even when no structural changes were made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please expand on this so that ppl can see its usefulness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about now?
That is, only if its string representation has changed.
Ah yes, point taken!
Took |
Very nice! LGTM. Let me release refactor-nrepl first so that merging this will work. |
I've released https://clojars.org/refactor-nrepl/versions/3.10.0 Please cherry-pick this commit 282a43c and test out the changes for about a week! Cheers - V |
Works as intended so far 👍 |
Thanks much! I've cut 3.12.0, to be melpa-visible in a bit. |
This allows for cleaning up whitespace even if there are no structural changes.
Note that I went with always replacing the ns form even if there were no whitespace changes because there's no function for only extracting the current ns form for comparison (in other words: there's only
clojure-delete-and-extract-sexp
but noclojure-extract-sexp
). It's probably fine!Depends on clojure-emacs/refactor-nrepl#407 and a corresponding update of
cljr-injected-middleware-version
once released.cask exec emacs -batch -Q -L . -eval "(progn (setq byte-compile-error-on-warn t) (batch-byte-compile))" clj-refactor.el
)./run-tests.sh
)