There's also c.k.simulateCommand('name-of-command'). I'm not sure why
there are both, since they seem to do the same thing. With either one, you
don't need to supply a fake event. The method takes care of that. I use
whichever one I remember first.
On Sunday, September 3, 2023 at 9:08:31 PM UTC-4 [email protected] wrote:
> I tend to use c.executeMinibufferCommand('name-of-command') -- doesn't
> need any extra parameters, and Just Works TM.
>
> Jake
>
> On Sun, Sep 3, 2023 at 8:41 PM Félix <[email protected]> wrote:
>
>> Making script in Leo is great, with the globally defined vars g, c and p
>> anything is possible.
>>
>> But what is the recommended way of doing a simple command by name in a
>> script?
>>
>> The *c.doCommandByName* method exists, but it insists on having an event
>> as a second parameter.
>>
>> I discovered that I can make it work by passing a fake event such as :
>> {"c": c}, or even a better one: g.app.gui.create_key_event(c), but this is
>> quite unintuitive. Could it not default to a valid default event if the
>> event is not passed?
>>
>> Félix
>>
>> --
>> 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/68b44f92-c2fd-403b-97aa-58fba041d366n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/leo-editor/68b44f92-c2fd-403b-97aa-58fba041d366n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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/1a332edf-26f0-4058-8565-73122da3b874n%40googlegroups.com.