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

Introduce threading refactoring commands#89

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 29, 2025
edited
Loading

All related tests fromclojure-mode pass except of those which "unjoin" lines, inclojure-mode it's implemented via text properties and doesn't work for the same expression after restarting Emacs. If it's an important feature, we can deal with that later.

I also fixed a couple of small issues with indentation and aligning forms.


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/thread-first-last branch from50c8809 tod9ae5fcCompareApril 29, 2025 12:16
@rrudakovrrudakov reopened thisApr 29, 2025
@rrudakov
Copy link
ContributorAuthor

Weird, I didn't close it. I guess GitHub did it somehow :)

(and (clojure-ts--list-node-p second-child)
(> (treesit-node-child-count second-childt)1))))

(defunclojure-ts-thread ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Shouldn't this raise some error if the form at point is not threadable?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Inclojure-ts-mode it just returnsnil, I did the same here. Maybe because it's used in a loop in boththread-first-all andthread-last-all?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Much of the refactoring code was copied fromclj-refactor in bulk early on, so I didn't pay close attention to each command there - that's why I notice some stuff for the first time.

I think it probably makes sense to have an optional param controlling whether to raise an error or returnnil, and perhaps even introduce some lower-level function that's not actually command that all of the commands call. (extracted fromclojure-ts-thread)

Any rate - what you're doing right now is a great opportunity for us to examine closely each refactoring command and make them slightly better here and there in the process of porting them toclojure-ts-mode.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I agree, I already discovered a few issues inclojure-mode commands and fixed them inclojure-ts-mode implementation.

I updated this function, it signalsuser-error now if called interactively and there is no threading form.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think it probably makes sense to have an optional param controlling whether to raise an error or returnnil, and perhaps even introduce some lower-level function that's not actually command that all of the commands call. (extracted fromclojure-ts-thread)

Perhaps we could look into it when we port more refactoring commands and see some pattern that can be extracted.

bbatsov reacted with thumbs up emoji
@bbatsov
Copy link
Member

All related tests from clojure-mode pass except of those which "unjoin" lines, in clojure-mode it's implemented via text properties and doesn't work for the same expression after restarting Emacs. If it's an important feature, we can deal with that later.

I wouldn't say that's particularly important.

rrudakov reacted with thumbs up emoji

@rrudakovrrudakovforce-pushed thefeature/thread-first-last branch fromd9ae5fc to63ab3d9CompareApril 29, 2025 13:09
@rrudakovrrudakov requested a review frombbatsovApril 29, 2025 13:10
@rrudakovrrudakovforce-pushed thefeature/thread-first-last branch from63ab3d9 toaace501CompareApril 29, 2025 13:43
@rrudakovrrudakovforce-pushed thefeature/thread-first-last branch fromaace501 to2fcc5c7CompareApril 29, 2025 14:54
@bbatsovbbatsov merged commit3569c90 intoclojure-emacs:mainApr 30, 2025
3 checks passed
@rrudakovrrudakov deleted the feature/thread-first-last branchApril 30, 2025 16:46
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