On Friday, August 15, 2014 6:37:48 AM UTC-5, Edward K. Ream wrote: > This post discusses discusses problems with the @g.command decorator.
In the end, I have opted for the bare minimum of changes. Given the complexity of key handling, I think this is the only sane way. Here is a slightly revised checkin log for rev 09ab839...: QQQ Cleaned up how command names get put into c.commandsDict and (now) c.inverseCommandsDict, but only a little bit ;-) All tests pass, but use a bit more caution. - Removed @g.command nodes from leoVim.py. vc.defineCommandNames now creates command names. - Called vc.defineCommandNames from the new c.createCommandNames, called from c.finishCreate. - Changed k.inverseCommandsDict to c.inverseCommandsDict. - Renamed ecm.finishCreateEditCommanders to ecm.defineCommandNames. QQQ All this adds up to *slightly* better code. In particular, the various o.defineCommandNames methods can be called any time after o has been created. These methods depend on nothing else, so they can be called "early" in c.finishCreate, by c.createCommandNames. This is a real plus: there are now a few less order dependencies in the startup code. Replacing rst.createCommandNames with rst.finishCreate is gratifying. Otoh, I left the code that creates c.commandsDict and c.inverseCommandsDict *strictly* alone, except that: 1. inverseCommandsDict is now a c ivar instead of a k ivar. 2. The new c.createCommandNames method encapsulates all aspects of the making of the command name dicts. This should make this difficult code slightly easier to understand. On balance, this was a long day of coding for minor improvements to Leo's startup logic. But these are steps in the right direction. In any case, the VimCommands class now defines command names in vc.defineCommandNames. There no need for vc.finishCreate and no need for all those redundant @g.command code hunks. Unless there are bugs reported, this ends this project for the foreseeable future. It's now time (at last!) to add the insert-file-name command. 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
