On Sun, Feb 22, 2009 at 3:26 AM, Edward K. Ream <[email protected]> wrote:
>> How about a "act-on-node" command? > Many commands can act on a node, but the idea of designating one of > them as the "node action" could open up even more possibilities. > > Rather than using events (hooks), uA's might be simpler. Plugins or > scripts could create a uA called, say, designatedAction. Perhaps some > (all?) nodes could have default designated actions. The value of the > uA would be a script, and the act-on-node command would simply execute > that script. Events hooks/callbacks are more flexible, in that they can do more complex analysis of a node (including the parent hierarchy). uAs would have to be updated externally, while act-on-node can always check a node completely before deciding to act on a node. At also moves the performance hit to the time you actually do act-on-node, instead of doing the checks with all nodes, all the time. Suppose that we wanted to improve the @url behaviour by allowing @url Leo website http://webpages.charter.net/edreamleo/front.html We could then add a new hook function that checked whether the first line is an url, and jumped there if it was. Otherwise, it would raise TryNext, causing leo to subsequently run the old url handler. As I said, an implementation of this can be directly snatched from IPython - it's just a callable that needs to be assigned to some agreed key, and after that it's just a documentation issue. Of course it's easy to add a hook that checks the uA designatedAction (or anthing else) and then runs the command. This is just a trivial special of the generic hook. -- Ville M. Vainio http://tinyurl.com/vainio --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
