embark icon indicating copy to clipboard operation
embark copied to clipboard

More repeatable actions to navigate, move, delete more targets?

Open hmelman opened this issue 4 years ago • 3 comments

Now that embark supports multiple targets and repeatable actions, it might be interesting to standardize on some more repeatable commands for more targets.

Let's take sentences. n and p move point forward and backward by sentences, that's great. t does transpose which in this case will move the current sentence forward and it's repeatable. If you give it an argument of -1 it will move the sentence backwards but that's not easily repeatable, you have to give the argument each time (or count ahead of time and use an argument like-4). Maybe a repeated command should auto-repeat the argument too?

What if we defined commands move-sentence-backwards and move-sentence-forwards and put them on M-p and M-n (or say P and N). What if n, p, M-n, M-p worked similarly for words and paragraphs? And in programming languages for symbols, sexps, lines, defuns, etc. Maybe a delete command could be repeatable too, so that after deleting a target, the next target is highlighted ready to be deleted as well.

I'm not sure about this and maybe it should be an additional package, but I wanted to throw the idea out there for comments. It seems to me this could be a poor man's objed mode.

hmelman avatar Sep 23 '21 19:09 hmelman

Some small comments on the current situation:

  • To make M-- t slightly easier to type I bound - to negative-argument, so t drags forward and - t backward. Binding a transpose command in more cases is definitely reasonable (I think we just have senetences, sexps and paragraphs now). I did also think about defining embark-tranpose-THING-backwards commands, so you don't need the negative prefix, but for now just did the - thing.

  • A delete command can easily de made repeatable by adding it to embark-repeat-actions. You can even have both repeatable and non-repeatable deletion commands by using defalias and making only one of them repeatable.

I do like your proposal, but I'm not sure how much of it we should have in the default configuration.

oantolin avatar Sep 23 '21 19:09 oantolin

  • so t drags forward and - t backward.

That's great. I wish this was more discoverable from a help screen. And this should be mentioned in the README.

hmelman avatar Sep 23 '21 20:09 hmelman

And it's not just - for negative-argument, I also bound all the numbers to digit-argument. I should definitely mention that in the README. (Updating the documentation is now the only reason I haven't tagged a 0.12 release; I'm just swamped at work right now, but the documentation update will happen soonish.)

oantolin avatar Sep 23 '21 22:09 oantolin