sachac / subed

subed is a subtitle editor for Emacs
177 stars 16 forks source link

Add video movement per frame #38

Closed mbork closed 3 years ago

mbork commented 3 years ago

Again, I'm open to suggestions re: keybindings. This feature is useful when you want the subtitle to appear (or hide) at some exact moment, e.g. when some text appears on the screen.

rndusr commented 3 years ago

This looks very useful.

But the keybindings are also very awkward. Especially because stepping forward and backward multiple times in a row is probably the most common usage.

I think the Emacs macro keybindings are ideal for such asituation: After pressing C-x e once to run the macro, you can just keep pressing e to run the same macro again and again. Pressing any other key has the normal effect, but it also makes the magic disappear and e behaves normally again.

The default mpv keybindings for frame stepping are . (step forward) and , (step backward). C-f . and C-f , could do a frame step, and pressing . and , again would keep stepping until any other key is pressed.

That would be the best behaviour I can think of, but I have no idea how complicated this would be to implement.

mbork commented 3 years ago

Great idea! Though I assume you meant C-c C-f , and C-c C-f .. I implemented your suggestion – it is perhaps not the cleanest possible implementation (I'll ask on the Emacs mailing list and make it better if some suggestion comes up), but it works fine. (Btw, I had to look up how to use transient keymaps – never did that before – but it is not difficult, since – as you've noticed – Emacs already has some support for that.)

rndusr commented 3 years ago

Great idea! Though I assume you meant C-c C-f , and C-c C-f ..

Yes, sorry, that's what I meant. Thank you.

I'm getting this error when I start Emacs:

Error (use-package): subed/:catch: Symbol’s value as variable is void: subed-mpv-frame-step-map

Can you reproduce that?

mbork commented 3 years ago

Of course, stupid me. Please delete the branch and pull it again – I fixed that mistake and rebased.

rndusr commented 3 years ago

That works nicely. Great work. Thanks!