Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Squashing part of a file without using --interactive #5782

Open
sgpthomas opened this issue Feb 22, 2025 · 4 comments
Open

FR: Squashing part of a file without using --interactive #5782

sgpthomas opened this issue Feb 22, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@sgpthomas
Copy link

Is your feature request related to a problem? Please describe.
I'm working on building a simple jj frontend in Emacs and I want to enable a workflow where you view the diff of your current edits, and squash select edits into some other change. As far as I can tell, there is no way to express a squash from just a region of a file from the command line.

Describe the solution you'd like
I guess I'm looking for something like an extension to the fileset language where you can select regions of a file. So a command might look something like jj squash --to m "region(foo.rs, 13:2, 15:1)". Totally winging the syntax here, but hopefully you get the idea.

Describe alternatives you've considered
It seems like the only other way of doing this is to create a dummy diffeditor to use for the -i editor that supports this syntax and directly modifies the temporary files. While possible, this seems pretty hacky. I guess the other way would be to use the jj api? But I haven't looked into that yet and would be more complicated to integrate. But maybe that's the best way forward. I would appreciate any feedback you might have.

@joyously
Copy link

Your description made me think of sending a "patch" through email, which seems similar.

@PhilipMetzger PhilipMetzger added the enhancement New feature or request label Feb 22, 2025
@PhilipMetzger
Copy link
Contributor

Why does jj split -i not work for you? I think this request is also similar to #5312.

@sgpthomas
Copy link
Author

I'm looking for something that doesn't use a TUI. I want to be able to fully specify what happens from the command arguments. In general, I think this would be useful for building tools on top of jj. But I also understand if that's not a direction you want to take the project.

@PhilipMetzger
Copy link
Contributor

I'm looking for something that doesn't use a TUI.

Ah, OK. Maybe we should make it configurable e.g jj split -i --tool <your-tool> so you can wrap it for Emacs.

I want to be able to fully specify what happens from the command arguments. In general, I think this would be useful for building tools on top of jj. But I also understand if that's not a direction you want to take the project.

Yes, that's very understandable. I don't think there's anything blocking it and is something the project should support to gain a wider ecosystem around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants