Are the 'eval' commands working? or is it just me?

62 views
Skip to first unread message

Félix

unread,
Oct 8, 2023, 10:30:08 PM10/8/23
to leo-editor
Trying out the eval commands from the minibuffer for the first time, following the examples in the documentation doesn't work for me... Am I doing something wrong?

To try out 'eval' and 'eval-last', the documentation says :
eval-last
---------

Inserts the result of the last eval in the body.
Suppose you have this text::

    The cat is 7 years, or 7*365 days old.

To replace 7*365 with 2555, do the following::

    select 7*367
    eval
    delete 7*365
    do eval-last

but selecting something makes the 'eval' execute the whole line instead of the selected text when I try it. (on windows).

Can you guys confirm/deny/comment on those commands from the mod_scripting plugin?

Félix

Edward K. Ream

unread,
Oct 9, 2023, 2:10:11 AM10/9/23
to leo-e...@googlegroups.com
On Sun, Oct 8, 2023 at 9:30 PM Félix <felix...@gmail.com> wrote:
Trying out the eval commands from the minibuffer for the first time, following the examples in the documentation doesn't work for me... Am I doing something wrong?

I'll take a look.

Edward

Edward K. Ream

unread,
Oct 9, 2023, 7:26:13 AM10/9/23
to leo-e...@googlegroups.com
On Sun, Oct 8, 2023 at 9:30 PM Félix <felix...@gmail.com> wrote:

Trying out the eval commands from the minibuffer for the first time, following the examples in the documentation doesn't work for me... Am I doing something wrong?

Note: This is issue #3598 and PR #3600. I have just changed the issue's title to "Retire all eval commands".

execute-script will suffice for any conceivable purpose. Your troubles indicate that nobody is using the eval commands.

Imo the EvalController class and all of Leo's eval commands should be retired. The code is a mess. No Leo dev should waste a moment trying to resuscitate it :-)

Edward


Thomas Passin

unread,
Oct 9, 2023, 8:34:28 AM10/9/23
to leo-editor
On Monday, October 9, 2023 at 7:26:13 AM UTC-4 Edward K. Ream wrote:
...

execute-script will suffice for any conceivable purpose. Your troubles indicate that nobody is using the eval commands.

I was not aware of them before Felix posted this thread, for what that's worth.  I wrote a script that takes selected text - it has to have the right format - and plots it as a Matplotlib graph.  I guess that illustrates your remark about execute-script.

Edward K. Ream

unread,
Oct 9, 2023, 9:11:37 AM10/9/23
to leo-e...@googlegroups.com


On Mon, Oct 9, 2023 at 7:34 AM Thomas Passin <tbp1...@gmail.com> wrote:

I was not aware of [Leo's eval commands] before Felix posted this thread, for what that's worth.  I wrote a script that takes selected text - it has to have the right format - and plots it as a Matplotlib graph.  I guess that illustrates your remark about execute-script.

Thanks for your comment.

In the unlikely event that someone does care, it would be straightforward to create a separate plugin to support them again. But I want no part of such a project :-)

Edward

Thomas Passin

unread,
Oct 9, 2023, 9:46:21 AM10/9/23
to leo-editor
The valuespace  plugin does something like this, but I found it confusing to use.

Edward K. Ream

unread,
Oct 9, 2023, 9:52:51 AM10/9/23
to leo-editor
On Monday, October 9, 2023 at 6:26:13 AM UTC-5 Edward K. Ream wrote:

> I have just changed [the title of issue #3598] to "Retire all eval commands".

mod_http.py contained a stealth setting, @bool http-allow-remote-exec, that enabled the ExecHandler in mod_http.py. This class evaluated incoming requests using the EvalController class in mod_scripting.py! The default for this setting was None/False, which probably mitigated the security concern.

A recent rev deleted the ExecHandler class from mod_http.py, so the security concern will soon be moot. Except for legacy versions of Leo, that is!

Edward

Edward K. Ream

unread,
Oct 9, 2023, 9:53:48 AM10/9/23
to leo-e...@googlegroups.com
On Mon, Oct 9, 2023 at 8:46 AM Thomas Passin <tbp1...@gmail.com> wrote:
The valuespace  plugin does something like this, but I found it confusing to use.

Me too.

Edward

Félix

unread,
Oct 9, 2023, 2:45:29 PM10/9/23
to leo-editor
Indeed, execute-script command already honors the current text-selection and will only run the selected text, if any, otherwise it will use the whole node's text. (and appropriate descendants if any '@others' present in the selection/node)

I'll gladly remove mod_scripting's eval commands from leojs. 
(they will also be automatically gone from leointeg's minibuffer when they leave Leo itself 😄 )

Félix

Edward K. Ream

unread,
Oct 9, 2023, 3:47:11 PM10/9/23
to leo-e...@googlegroups.com
On Mon, Oct 9, 2023 at 1:45 PM Félix <felix...@gmail.com> wrote:
Indeed, execute-script command already honors the current text-selection and will only run the selected text, if any, otherwise it will use the whole node's text. (and appropriate descendants if any '@others' present in the selection/node)

I'll gladly remove mod_scripting's eval commands from leojs. 
(they will also be automatically gone from leointeg's minibuffer when they leave Leo itself 😄 )

Yes. Please remove the eval commands from leoJS.

Edward

Edward K. Ream

unread,
Oct 10, 2023, 7:27:25 AM10/10/23
to leo-editor
On Monday, October 9, 2023 at 8:52:51 AM UTC-5 Edward K. Ream wrote:

> > I have just changed [the title of issue #3598] to "Retire all eval commands".

PR #3600 has been merged into devel. Leo's eval commands are gone for good.

Edward
Reply all
Reply to author
Forward
0 new messages