Use appropriate coding system when unzipping jars #3004
Merged
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.
in
cider-find-file
. This prevents CRLF encoded files from appearing with ^Mcharacters at the end of each line, which, in turn, avoids confusing
clojure-find-ns
and breakingcider-find-var
.clojure-find-ns
uses Emacs'(thing-at-point 'symbol)
as part of identifyinga file's namespace, and when a file isn't decoded properly, namespaces can be
reported as
my.lib^M
whichcider-find-var
won't know what to do with.Hey again! I came across https://github.com/clojure-emacs/cider/discussions/2957 today, where @expez mentions
cider-find-var
is broken in jars. I do this all the time and it works fine, so I looked into the repro a little and found thatcider-find-var
was getting confused incljfx.api
, as extracted from its jar, because it has windows line endings.The nrepl message trace:
The ns value is obtained from
clojure-find-ns
via(thing-at-point 'symbol)
, which will include the^M
if it's there.While we could wrap a
(string-trim-right ...)
around the ns name somewhere, that shouldn't really be necessary, andclojure-mode
usesthing-at-point
in several other ways so this might not be the only broken thing. The^M
s are also a bit of an eyesore, so I think attempting to get rid of them is the way to go. People might still be broken by files with mixed encoding though.eldev test
)eldev lint
) which is based onelisp-lint
and includescheckdoc
, check-declare, packaging metadata, indentation, and trailing whitespace checks.