Here is how it is done: (put 'sleep-for 'interactive-form (Not that it is extremely useful, but still.) It turns out that I can change a function into a command without actually redefining it. The final takeaway from the thread was something that blew my mind. This I learned from the manual, though, not from the discussion.) It is so cool I am going to write a separate blog post about it. Emacs being Emacs, such a feature exists. It would be even better if it could then e.g. (In fact, it would be even better if I could include a “break” in the keyboard macro, so that Emacs would pause during its execution. Although in this particular use-case this might not be the best idea (see my comment about unbalanced parens above), this technique is a very useful thing I tend to forget about from time to time. The next thing (and probably the most valuable of all this) was that I could attain my goal in a completely different way: what I could do is to start recording my macro with point already on the beginning of \todo, and isearch for the next occurrence at the end of the macro. Then, I learned that sleep-for does not update the display anyway, so what I really needed was sit-for (which does that, and a lot more). But here are the things I learnt.įirst of all, nothing stops me from saying M-: (sleep-for 1) RET in my keyboard macro. The TL DR is that it was not a good idea. I learned a bit from a few answers there. Well, the Emacs community did not disappoint. I then sent an email to the emacs-devel mailing list, asking whether it could be good idea to make sleep-for interactive. I quickly found the sleep-for function, only to discover that it is not a command. What to do? Well, my first idea was to make Emacs sleep for a second before firing C-M-f. (And sometimes indeed it didn’t work – when the argument of \todo had unbalanced parens, which tripped forward-sexp). That worked well, but I had one problem with it: when the next occurrence of the \todo was not visible, I felt I was losing control and I was unsure whether my macro did what it should do.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |