Closed markgdawson closed 2 years ago
I've created a PR #606 which does seem to fix the behavior. There are a few elements to this:
lispy--read
was causing commas to be read as clojure-symbol
as opposed to clojure-commas
.clojure-commas
. The printing tries to delete the space before the comma (which is desirable), but when printing just a comma in isolation, this is before the start of the buffer. That causes the trace above.lispy--slurp-whitespace
, which "slurps" whitespace between lists. and added an optional argument to lispy-interleave
to slurp whitespace. Then added this optional argument under lispy-multiline-1
to cause lispy-interleave
to slurp whitespace.Note however that this would break the fix implemented in https://github.com/abo-abo/lispy/issues/537 (again)
I don't know the best way to fix this for Hy. But I'm not sure that the proposed fix of adding ,
to the regexp, breaking clojure-commas
, is the optimal approach.
Would this also fix lispy-kill deleting more than the current line if the line ends in a comma?
@cstby I've fixed lispy-kill
. Thanks for the report.
Any time. Thank you for the fix, and for all your work on this wonderful package.
Formatting the following clojure code with M (multiline):
produces:
The commas (which are whitespace) appear at the start of the line. I would have expected them to appear at the end of the previous line.
After some digging, I suspect the issue could be in
lispy--read
. Runninglispy-read
on the code above (in clojure-mode) produces:I note that there is a
clojure-comma
type in thelispy-read
function. Should this be used instead ofclojure-symbol
?Running
(lispy--read ",")
returns(ly-raw clojure-symbol ",")
.It seemed that this behaviour changed in commit 8bad03705362794876081b44802ad0932faa4f30, where a comma was added for Hy. Prior to that commit,
lispy-read
would return(ly-raw clojure-commas ",")
for commas in clojure.However, unfortunately, attempting to revert this commit causes other issues for me. I get the traceback below from applying multiline to the example above. And I'm not sure how I can fix this.