Yesterday I made the macro commands functional. Leo now supports the following commands:
call-last-keyboard-macro # call an unnamed macro. call-kbd-macro # prompts for macro name, then executes it. load-file # prompts for file containing pickled macros. name-last-kbd-macro # names last recorded macro. print-macros # prints macro names (should print defs too). save-kbd-macros # saves pickled macros to a file. start-kbd-macro # starts recording a macro. Ends with ctrl-g. I'll soon make sure that default menus includes these. When I awoke this morning, my thought was that macros are an outmoded idea. With Leo, we would typically use @command or @button to automate tasks. Furthermore, if I did want to save macros, I would want commands like: save-macro-to-body-text. I would then "name" the macro by putting '@macro name [...@key=whatever]' in a headline. In other words, saving macros to a file is way too clumsy. Much better to save them to @macro nodes. The body text would consist of a list of strokes (canonicalized key bindings). However, I just reread the following from Robin Dunn's post, "Your mission, should you choose to accept it" from pyxides: QQQ * Good keystroke macro recording and the ability to save and load keystroke macros, and the ability to assign a key-binding to a saved recorded macro. Any time I need to make the same edits to a bunch of lines or groups of lines I'll record doing it on the first one including the keystrokes needed to reposition for the next line, and then stop recording and then it's just one keystroke to replay the keystrokes for every other line that needs it done. I record, use and throw away up to a dozen or so macros per day. QQQ Is anyone excited that Leo now supports macros? I'm certainly not. Comments, please. Edward P.S. We can be pretty sure that macro playback works reliably. Indeed, macro recording now saves complete leoKeyEvent objects, so playing back a macro is trivial: we simply call k.masterKeyHandler with the key events. In particular, leoKeyEvents can represent any key press, including, for example, ctrl-s, or ctrl-x<whatever>return. Reading and writing macro defs is done as follows. For writes, Leo converts a leoKeyEvent object e to e.stroke, a simple string. For reads, we reconstitute a proxy for a leoKeyEvent that works for k.masterKeyHandler. EKR --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en -~----------~----~----~----~------~----~------~--~---
