On Tuesday, October 2, 2012 11:18:10 AM UTC-7, Edward K. Ream wrote: > > Of course you can! That's what Leo's Ctrl-B (execute-script) does. > > Doc string says "We execute the selected text, or the entire body text if no text is selected." Yes that is exactly what I was looking for,
On Tue, Oct 2, 2012 at 12:44 PM, F.S. <[email protected] <javascript:>> > wrote: > > > However in > > Emacs it is easy to attach arbitrary action to any text through buttons > that > > can be placed anywhere in any buffer. > > That's what Leo's script buttons do. A script button script could act > on the entire file (as in Emacs) or on the presently selected node > (typical) or on a found set of nodes, say all the nodes with > @something in the headline. > > So if you *only* consider nodes to be equivalent to emacs buffers, > @button scripts are just as powerful as emacs buttons. But in > addition, @button scripts have full, easy access to all aspects of > Leo's outline structure. Thus, Leo scripts can easily do things that > would be extremely laborious in emacs. > > I think we have a little misunderstanding of what emacs buttons are. They are close cousins of text-properties. They make any text (a word, a character or a region) clickable by associating function hooks to the text, akin to hyperlinks. This is very useful for exploring data by making the data active. The context of the action is already provided by the text you click on. For example if I were to generate a tree I could embed different actions at different nodes based on the knowledge I have about the data structure. @buttons are powerful but they perform a different function. > > * Yes that does mess up the namespace that may have to be taken care of > > later but it is well worth the effort. > > Executing scripts is safe. For details, look at the code in > c.executeScript. > > What I was referring to was that when we eval everything at the top level of course we break all the module restrictions. And intermingled with interactive sessions, it is easy to interactively set something but then to forget to have it in the actual code. This is part and parcel of the methodology, not something peculiar about Leo or Emacs. But it is a small price to pay for the benefits of REPL and the pitfalls can be mitigated through care. Thanks for the education. I am learning more of Leo's power as the hours go by, literally. -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To view this discussion on the web visit https://groups.google.com/d/msg/leo-editor/-/LUWuAA-lEwYJ. 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.
