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

meow--select: don't spam mark-ring #589

Closed
wants to merge 1 commit into from

Conversation

45mg
Copy link
Contributor

@45mg 45mg commented May 4, 2024

For example, without this change, calling meow-next-word repeatedly on a selection created by meow-mark-word will repeatedly push the position at the beginning of the selection onto the mark-ring. This can quickly overflow the mark-ring with identical positions, and it makes pop-to-mark-command a lot more annoying to use.

For example, without this change, calling `meow-next-word` repeatedly on
a selection created by `meow-mark-word` will repeatedly push the
position at the beginning of the selection onto the mark-ring. This can
quickly overflow the mark-ring, and it makes `pop-to-mark-command` a lot
more annoying to use.
@DogLooksGood
Copy link
Collaborator

I think you inspired me that we should only keep one mark for each type of selection no matter how it gets extended. So I probably want to have this patch for all commands, and do it in a better way.

@45mg
Copy link
Contributor Author

45mg commented May 4, 2024

Glad to hear it! The fact that all the Meow motions create selections means that the mark ring automatically becomes a tool for jumping back to previous edit positions.

How would you feel about an unpop-to-mark-command in Meow, to move from older to newer positions in the mark ring? I've already implemented one. With that, combined with this fix, Meow would achieve the functionality of better-jumper via built-in Emacs features.

@DogLooksGood
Copy link
Collaborator

Sorry for the late response, yeah, I would like to learn more about your idea. I think current mark-ring usage wasn't good. I'd like to have an improvement here.

@45mg
Copy link
Contributor Author

45mg commented Oct 11, 2024

Sorry for the late response, yeah, I would like to learn more about your idea. I think current mark-ring usage wasn't good. I'd like to have an improvement here.

My idea is pretty much what I said in my first comment - since the user moves around and edits using Meow motions, and those motions create selections, the user's movement and edit positions are saved in the mark ring. This means that one can move back to previous positions using pop-to-mark-command. I wrote an unpop-to-mark-command which then allows you to move back to more recent positions. This pair of commands basically models the same functionality as better-jumper, or Vim's Ctrl-O and Ctrl-I.

But, like you said, this will work better if every selection results in only one position being added to the mark ring. This PR doesn't cover that...

@DogLooksGood
Copy link
Collaborator

I think we can achieve this simply by comparing the current selection type and new selection type.

I'm thinking whether we should keep the same type of first choice or last choice.

@DogLooksGood
Copy link
Collaborator

Fixed in the latest command, also see

Now we have something similar to C-i/C-o in Vim

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

Successfully merging this pull request may close these issues.

2 participants