I was using afterChangeNodeContents instead of afterChangeBody in leoInteg when modifying the body pane... (I''m currently trying to debug the first modif of the first node changed that seem to fail) I'm gonna try with this afterChangeBody instead :) -- Félix
On Saturday, October 31, 2020 at 12:57:33 PM UTC-4, Edward K. Ream wrote: > > #1413 <https://github.com/leo-editor/leo-editor/issues/1413> was > originally a request for reinstating emacs-style macros. I'm not likely to > do that. Emacs macros are seldom used, and they are not very powerful > without even more nerdy (non-existent) extensions such as emacs registers. > > Instead, I shall attempt to make it easier to write Leonine scripts that > change body text. > > For example, I recently worked on the php colorizer in leo/modes/php.py. > This involved renaming groups of rules in a systematic way. Neither emacs > macros nor regular expressions come anywhere close to handling this task. > So a Leonine script is required. > > While thinking about such scripts, I reviewed Leo's resources for changing > body text. What I found was a mess of overlapping, ugly code. Substantial > refactoring is in order. The goal will be to create a pattern something > like this: > > u = c.undoer > > data = u.beforeChangeBody() > << change p.b >> > c.afterChangeBody(undo_type, data) > > This pattern should replace all calls to LeoBody.onBodyChanged and > c.updateBodyPane. A guiding principle will be to avoid keyword arguments > (kwargs) wherever possible. > > There are complexities involved that I won't discuss here. We shall see > what happens :-) > > Edward > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/7fce6b58-c4b0-40ff-9ad7-a44bdd4a5beeo%40googlegroups.com.
