You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
should preserve the comments and not unbalance parens.
eg.
(->> y
(bar)
(foo x ;; grobble
))
Actual behavior
(->> (bar y)
(foo x ;; grobble))
The closing parens are merged into the comment, breaking the structure.
Steps to reproduce the problem
Run C-c C-r l on an expression with a line comment.
Breaks even when comment is on its own line
(drop2;; TODO use transducers
(map inc
(filter even?
(range100))))
This could probably be fixed by adding a (clojure--in-comment-p) check in the right place. But I wonder if some of these refactorings could be written with parseclj to be more robust.. Eg. most don't deal well with metadata or #_ ignored forms. The threading commands happen to be the most complex from the looks of the code.
Environment & Version information
clojure-mode version
clojure-mode (version 5.13.0)
Emacs version
28.0.91
Operating system
macOS 12
The text was updated successfully, but these errors were encountered:
This could be as well be done with a tool of the rewrite-clj family, which while would need a CIDER connection, it would seem work that is more likely to happen (and more likely to be reused; CIDER isn't limited in scope to emacs).
It seems already implemented in clojure-lsp, see https://clojure-lsp.io/features/. So whatever its implementation is, either it could be directly used (by using clojure-lsp as-is) or borrowed (via CIDER).
All in all, the broken behavior is trivially fixable by just hitting RET in the right place, so I'd wager that the cost/benefit ratio of a reimplementation would be far from attractive.
Expected behavior
Running
clojure-thread-last-all
on the followingshould preserve the comments and not unbalance parens.
eg.
Actual behavior
The closing parens are merged into the comment, breaking the structure.
Steps to reproduce the problem
Run
C-c C-r l
on an expression with a line comment.Breaks even when comment is on its own line
This could probably be fixed by adding a
(clojure--in-comment-p)
check in the right place. But I wonder if some of these refactorings could be written with parseclj to be more robust.. Eg. most don't deal well with metadata or#_
ignored forms. The threading commands happen to be the most complex from the looks of the code.Environment & Version information
clojure-mode version
Emacs version
28.0.91
Operating system
macOS 12
The text was updated successfully, but these errors were encountered: