* bug#72952: 30.0.90; Want way to break out of Eshell for loop
@ 2024-09-02 8:26 Sean Whitton
2024-09-09 0:59 ` Jim Porter
0 siblings, 1 reply; 3+ messages in thread
From: Sean Whitton @ 2024-09-02 8:26 UTC (permalink / raw)
To: 72952; +Cc: jporterbugs
X-debbugs-cc: jporterbugs@gmail.com
I am trying to run a series of tests like this:
% for test in tests/tests/tagupl* { tests/using-intree $test }
I want the command to give up as soon as one of the tests fails. But I
don't think there is any way to break out of the loop? In POSIX sh, you
could use 'break'.
Thanks.
--
Sean Whitton
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#72952: 30.0.90; Want way to break out of Eshell for loop
2024-09-02 8:26 bug#72952: 30.0.90; Want way to break out of Eshell for loop Sean Whitton
@ 2024-09-09 0:59 ` Jim Porter
2024-09-12 10:04 ` Sean Whitton
0 siblings, 1 reply; 3+ messages in thread
From: Jim Porter @ 2024-09-09 0:59 UTC (permalink / raw)
To: Sean Whitton, 72952
On 9/2/2024 1:26 AM, Sean Whitton wrote:
> X-debbugs-cc: jporterbugs@gmail.com
>
> I am trying to run a series of tests like this:
>
> % for test in tests/tests/tagupl* { tests/using-intree $test }
>
> I want the command to give up as soon as one of the tests fails. But I
> don't think there is any way to break out of the loop? In POSIX sh, you
> could use 'break'.
I actually have a patch sitting in my pile of branches that does this,
but it needs a fair bit more work to get right. The main thing it needs
is to keep 'break' from bubbling up too far (e.g. if you run an Eshell
script from inside a loop, 'break' at the top level of the script
shouldn't break out of the parent loop).
Another way to do something like this would be to embrace the Lispy-ness
of Eshell and add a command-form for 'throw' and 'catch'. Something like:
catch my-tag {
for i in *.el {
do-stuff
if something-or-other { throw my-tag }
}
}
Or even support both 'throw'/'catch' *and* 'break'...
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#72952: 30.0.90; Want way to break out of Eshell for loop
2024-09-09 0:59 ` Jim Porter
@ 2024-09-12 10:04 ` Sean Whitton
0 siblings, 0 replies; 3+ messages in thread
From: Sean Whitton @ 2024-09-12 10:04 UTC (permalink / raw)
To: Jim Porter; +Cc: 72952
Hello,
On Sun 08 Sep 2024 at 05:59pm -07, Jim Porter wrote:
> On 9/2/2024 1:26 AM, Sean Whitton wrote:
>> X-debbugs-cc: jporterbugs@gmail.com
>> I am trying to run a series of tests like this:
>> % for test in tests/tests/tagupl* { tests/using-intree $test }
>> I want the command to give up as soon as one of the tests fails. But I
>> don't think there is any way to break out of the loop? In POSIX sh, you
>> could use 'break'.
>
> I actually have a patch sitting in my pile of branches that does this, but it
> needs a fair bit more work to get right. The main thing it needs is to keep
> 'break' from bubbling up too far (e.g. if you run an Eshell script from inside
> a loop, 'break' at the top level of the script shouldn't break out of the
> parent loop).
>
> Another way to do something like this would be to embrace the Lispy-ness of
> Eshell and add a command-form for 'throw' and 'catch'. Something like:
>
> catch my-tag {
> for i in *.el {
> do-stuff
> if something-or-other { throw my-tag }
> }
> }
>
> Or even support both 'throw'/'catch' *and* 'break'...
Heh. throw/catch seems like overkill to me but supporting both would be
cool!
--
Sean Whitton
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-12 10:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 8:26 bug#72952: 30.0.90; Want way to break out of Eshell for loop Sean Whitton
2024-09-09 0:59 ` Jim Porter
2024-09-12 10:04 ` Sean Whitton
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).