Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add unwind refactoring commands#88

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@rrudakov
Copy link
Contributor

@rrudakovrrudakov commentedApr 28, 2025
edited
Loading

The new commands work the same as inclojure-mode with one improvement (hopefully):

Inclojure-mode unwinding form(-> foo bar) would produce(-> (bar foo)), so you need to run unwind command one more time to get rid of threading macro. Inclojure-ts-mode it will produce(bar foo) immediately. Because of that I had to adapt tests fromclojure-mode a little bit.


Before submitting a PR mark the checkboxes for the items you've done (if you
think a checkbox does not apply, then leave it unchecked):

  • The commits are consistent with ourcontribution guidelines.
  • You've added tests (if possible) to cover your change(s). Bugfix, indentation, and font-lock tests are extremely important!
  • You've runM-x checkdoc and fixed any warnings in the code you've written.
  • You've updated the changelog (if adding/changing user-visible functionality).
  • You've updated the readme (if adding/changing user-visible functionality).

Thanks!

@rrudakovrrudakovforce-pushed thefeature/threading-refactoring branch 2 times, most recently from0759b39 to2db43a4CompareApril 28, 2025 10:11
@bbatsov
Copy link
Member

Apart from my small inline remarks I can suggest also:

  • to add a command that displays the unwound version in a separate buffer (I think this will be useful for debug purposes)
  • the inverse command (that convert the normal presentation in a threaded one - I'm guessing that's more common refactoring in practice)

Overall, the PR looks good to me, though.

@rrudakov
Copy link
ContributorAuthor

Apart from my small inline remarks I can suggest also:

  • to add a command that displays the unwound version in a separate buffer (I think this will be useful for debug purposes)

Could you please suggest a command name for that?

  • the inverse command (that convert the normal presentation in a threaded one - I'm guessing that's more common refactoring in practice)

Sure. I'm planning to port refactoring commands fromclojure-mode and I'm going from top to bottom one thing at the time (to avoid big PRs). It happens thatunwind was first :)

Overall, the PR looks good to me, though.

Thanks! I'll fix all the issues.

@rrudakovrrudakovforce-pushed thefeature/threading-refactoring branch from2db43a4 tof6ef592CompareApril 28, 2025 12:04
@rrudakovrrudakov requested a review frombbatsovApril 28, 2025 12:26
@bbatsov
Copy link
Member

Could you please suggest a command name for that?

Perhaps something likeclojure-ts-show-unwound? Orclojure-ts-unwind-to-buffer? Obviously people can get the same result usingcider-macroexpand, but I'm guessing the people who use the refactoring commands inclojure-mode, probably are not heavy CIDER users.

@bbatsov
Copy link
Member

Sure. I'm planning to port refactoring commands from clojure-mode and I'm going from top to bottom one thing at the time (to avoid big PRs). It happens that unwind was first :)

I figured something like this was the case. :-)

@rrudakov
Copy link
ContributorAuthor

Could you please suggest a command name for that?

Perhaps something likeclojure-ts-show-unwound? Orclojure-ts-unwind-to-buffer? Obviously people can get the same result usingcider-macroexpand, but I'm guessing the people who use the refactoring commands inclojure-mode, probably are not heavy CIDER users.

After giving it some thoughts, I think it would be better to implement in a separate PR. Ideally this would require defining a new minor modeclojure-ts-popup-buffer-mode, write some functions to setup buffer name, major-mode and bindq toquit-buffer, perform unwind command in a temp buffer and insert the result.@bbatsov maybe you could suggest a better idea?

@rrudakovrrudakovforce-pushed thefeature/threading-refactoring branch fromf6ef592 to97bde83CompareApril 29, 2025 09:20
@bbatsov
Copy link
Member

After giving it some thoughts, I think it would be better to implement in a separate PR. Ideally this would require defining a new minor mode clojure-ts-popup-buffer-mode, write some functions to setup buffer name, major-mode and bind q to quit-buffer, perform unwind command in a temp buffer and insert the result.@bbatsov maybe you could suggest a better idea?

No, that's more or less what I normally do in such situations. It's fairly simple and standard - you can usecider-macroexpansion.el as a point of reference. Let's have this as a separate PR.

rrudakov reacted with thumbs up emoji

@bbatsovbbatsov merged commit4bdd7f2 intoclojure-emacs:mainApr 29, 2025
3 checks passed
@rrudakovrrudakov deleted the feature/threading-refactoring branchApril 29, 2025 12:10
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@bbatsovbbatsovbbatsov approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@rrudakov@bbatsov

[8]ページ先頭

©2009-2025 Movatter.jp