Run editor selection

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Run editor selection

Torsten Lilge
Hi everyone,

I would like to discuss the desired behavior, when running code, which
is selected in the gui's editor ("Run Selection"). Currently the
selected code is executed in the console line by line. This does not
work if a keyboard command is included, which is more or less ignored
(see https://savannah.gnu.org/bugs/?42705).

Using Fsource of a temp. file or Feval would solve this issue. However,
in this case, the commands themselves are not displayed in the console
and are not added to the history. This in turn could be fixed by, e.g.,
extending the selected text by commands for displaying and updateing the
history.

What is the desired behavior here, execute the selected portion of code
like a script or as if it was manually entered into the console?

Best,
Torsten



Reply | Threaded
Open this post in threaded view
|

Re: Run editor selection

apjanke-floss

On 10/20/19 8:41 AM, Torsten Lilge wrote:

> Hi everyone,
>
> I would like to discuss the desired behavior, when running code, which
> is selected in the gui's editor ("Run Selection"). Currently the
> selected code is executed in the console line by line. This does not
> work if a keyboard command is included, which is more or less ignored
> (see https://savannah.gnu.org/bugs/?42705).
>
> Using Fsource of a temp. file or Feval would solve this issue. However,
> in this case, the commands themselves are not displayed in the console
> and are not added to the history. This in turn could be fixed by, e.g.,
> extending the selected text by commands for displaying and updateing the
> history.
>
> What is the desired behavior here, execute the selected portion of code
> like a script or as if it was manually entered into the console?

This might be my "do what Matlab does" bias speaking, but I prefer the
current behavior of it executing line-by-line as though typed in the
terminal, and getting added to the command history.

Most of the time when I use Run Selection, I'm either iterating
development on a script that I run incrementally in the base workspace,
or in a "dbstop" breakpoint in the debugger, poking at local data and
trying various things. In both these situations, it's handy to have the
evaluated commands in the history.

Cheers,
Andrew

Reply | Threaded
Open this post in threaded view
|

Re: Run editor selection

nrjank
On Sun, Oct 20, 2019 at 2:27 PM Andrew Janke <[hidden email]> wrote:
>
>
> On 10/20/19 8:41 AM, Torsten Lilge wrote:
...
> Most of the time when I use Run Selection, I'm either iterating
> development on a script that I run incrementally in the base workspace,
> or in a "dbstop" breakpoint in the debugger, poking at local data and
> trying various things. In both these situations, it's handy to have the
> evaluated commands in the history.

I'll just add a 'me too' to this.