On Oct 16, 7:50 am, "Edward K. Ream" <[email protected]> wrote:

> Last night I had a forehead-slapping moment: the place to put @button
> nodes is in myLeoSettings.leo.
>
> This morning, I realized that using @command rather than @button
> completes the Aha.

Rev 4598 contains surprisingly complex changes intended to make this
work more smoothly.

- Equal sign now optional after @args.

- Cleaning button/command names removes {comments}, and retains @ and
@button.

- The logic that handles @button and @command nodes is less verbose,
as discussed below.

The intended effect of these changes are as follows:

<alt-x>@<tab> will now show all commands created by @button and
@command nodes, including everything except {comments}.  For example::

    @button test-button @key alt-ctrl-5 button: <Alt+Ctrl+Key+5>
    @command check-bindings
    @command clean-body
    @command create @auto nodes  @args c:\apps\pygments
\pygments,.py,.c
    @command flatten script
    @command join-node-above
    @command join-node-below
    
@command promote-bodies

As you can see, typing completion will show you @key and @args values.

Some other minor changes:

- As you can see, the typing completion shows the node's headlines as
is, except that {comments} are deleted.

- A minor change, which can be undone or revised if necessary:  The
@args list now sets a predefined script_args argument rather than set
sys.argv, which could be a bit clumsy.

Discussion
========

These are nitty-gritty changes, and yet they have, imo, fairly
momentous implications.  For the first time, the following show all
@button and @commands::

    <alt-x>@<tab>    # Shows both @button and @commands.
    <alt-x>@b<tab>  # Shows all @button commands.
    <alt-x>@c<tab>  # Shows all @command commands.

This leverages Leo's autocompleter in a great new way.  If will be
possible to define dozens or even hundreds of "personal" commands
without having to remember all the details.

By analogy with the print-settings commands, I plan to create a print-
buttons command, which will show all @button nodes (and probably all
@command nodes as well) along with an indication of which .leo file
defined the nodes, much like the print-settings command does.

Imo, today's work is a very significant step forward.

As indicated above, the actual code in mod_scripting.py and other
places is quite picky.  There could easily be bugs.  If so, please
report the problems *here*, rather than file separate bug reports.

Please let me know how the scheme works for you.  I'll be happy to
make minor adjustments as needed.

Edward

-- 
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.

Reply via email to