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

Executing a kmacro with F3 and F4 in beacon mode results in normal mode that still has secondary selection. #654

Open
amano-kenji opened this issue Oct 28, 2024 · 12 comments

Comments

@amano-kenji
Copy link

After meow-beacon-{insert,change,append}, beacon mode is retained. Thus, pressing G again exits beacon mode.

However, after F3 and F4, beacon mode is exited, but the normal mode still has secondary selection.

This seems to be an undefined state.

@DogLooksGood
Copy link
Collaborator

I'm not sure about understanding your question. But whether or not you are in beacon state depends on whether or not the cursor is in the secondary selection.

When you have a secondary selection, and the cursor is inside, then you are in beacon state, otherwise it is still normal state. So it's normal to have a secondary selection in normal state, and you can cancel it with G. Additionally, there are other commands like meow-swap-grab and meow-sync-grab to work with secondary selection.

@amano-kenji
Copy link
Author

amano-kenji commented Oct 28, 2024

This needs to be documented better. I don't really understand what G does.

@DogLooksGood
Copy link
Collaborator

G creates a secondary selection, in Emacs there could be only one secondary selection, and it can have zero length.

https://www.gnu.org/software/emacs/manual/html_node/emacs/Secondary-Selection.html

@amano-kenji
Copy link
Author

amano-kenji commented Oct 29, 2024

Emacs is supposed to be self-documenting. The relevant documentation should be available in emacs.

If I press Ctrl-h k G, I don't get much information and referral to more documentation.

It doesn't say multiple cursors. It doesn't say it cancels beacon mode along with an existing secondary selection.

meow-tutor doesn't say when beacon mode is exited. meow-tutor just says G grabs the selection or cancels the grab. Meow-tutor doesn't say how multiple cursors work.

markdown documents don't say grab. They say beacon mode and how multiple cursors work.

The documentation is fragmented and confusing. Emacs documentation should be cohesive and coherent.

@amano-kenji
Copy link
Author

amano-kenji commented Oct 29, 2024

I still don't understand why pressing F4 in the normal mode executes the macro on multiple cursors. Beacon mode was exited when I pressed F3 and the cursor got outside secondary selections.

Is this emacs built-in functionality? Or, is it meow?

Because G relies on intricacies, the intricacies have to be explained, or I get confused. It is complex. If I don't understand the complex intricacies, I don't understand how to manipulate it.

I don't know what's happening under the surface. I feel that I have to become a maintainer of meow mode to just understand how G works.

When I use multiple cursors in kakoune or helix, I quickly understand how multiple cursors work without having to read code.

@DogLooksGood
Copy link
Collaborator

I think you made a good point. I agree we should have some documents for meow-beacon-mode, so people won't confuse about its functionalities. Now the only content about beacon state is this section in tutorial.org and this section in explanation. I will add some docs to these modes.

Following is the quick answers to your questions here. Just let me know if it makes sense?

meow-grab is a very simple command to create secondary selection. it produces the same result as grabbing text with the mouse while holding down the Meta key. Instead of using mouse, you convert current region with meow-grab.

And beacon state is a state to create beacons. Beacons are the locations where you want to apply the upcoming kmacro. When you have beacons, the next kmacro will be applied to these locations immediately and automatically. So the key here is having beacons and a kmacro. The beacon state is just a state for beacon creation.

So this is basically how it works,

  • Create a secondary selection, and beacon state is on. Now we have the scope for editing.
  • Create beacons by moving the cursor. Now we have the pattern of locations for editing.
  • Start macro recording, via F3 or entering insert state, beacon state is off now.
  • End macro recording, Now we have the content of editing.
  • Because we have beacons, this kmacro will be applied automatically.

@amano-kenji
Copy link
Author

amano-kenji commented Oct 30, 2024

I see now. I think documentation should be available in emacs. Things like function doc and info manual.

When I need to learn, I use info manual or Ctrl-h k.

@DogLooksGood
Copy link
Collaborator

There is one obstacle for having info. Because the key bindings are dynamic, and info is static. So we can't have something like n p f d, it has to be <meow-next> <meow-prev> .... The reading experience is kinda bad. We can only have something like meow-tutor where we can interpolate the actual key binding.

@amano-kenji
Copy link
Author

amano-kenji commented Oct 30, 2024

Why don't you provide users with default key bindings? Users can still customize key bindings later.

I want to have default keybindings so that I don't have to worry about keeping up with keybinding updates.

Default key bindings still won't enable info manual because there are multiple keyboard layouts, but I want default keybindings.

Meow-tutor can document beacons and beacon mode better.

@DogLooksGood
Copy link
Collaborator

I have no idea what would be a good default. I'm very opinionated and picky about keybindings, and I believe others the same. Therefore I must have some rules that makes perfect sense to myself and makes no sense to others.

@amano-kenji
Copy link
Author

I have used https://github.com/meow-edit/meow/blob/master/KEYBINDING_QWERTY.org without modification.

@DogLooksGood
Copy link
Collaborator

The example keybindings are given in a way that it's more likely to be familiar to users(because HJKL stuff). But I don't think that's an optimized layout, and I don't want to debate on which command should be put on which key, at least for now. I think the focus of this project is more about having minimal command set to get the job done, and having better integration with Emacs defaults.

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

No branches or pull requests

2 participants