Closed DerGuteMoritz closed 6 months ago
Unfortunately this doesn't seem ideal as it can needlessly
touch
the underlying file - might be wasteful for misc other tools.
Ah yes, point taken!
Note that there's
defun cljr--maybe-eval-ns-form
. Jumping to definition from there you can find inspiration.
Took clojure-delete-and-extract-sexp
as inspiration instead. Not too happy about the string-trim-right
which is necessary because the string returned by refactor-nrepl
comes with a trailing newline. Could of course also be changed on that end but oh well!
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 https://github.com/clojure-emacs/clj-refactor.el/commit/282a43c3139e8f2aadb102616d2839adeab11a67 and test out the changes for about a week!
Cheers - V
Works as intended so far :+1:
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 https://github.com/clojure-emacs/refactor-nrepl/pull/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
)