GNU bug report logs -
#72952
30.0.90; Want way to break out of Eshell for loop
Previous Next
Full log
Message #8 received at 72952 <at> debbugs.gnu.org (full text, mbox):
On 9/2/2024 1:26 AM, Sean Whitton wrote:
> X-debbugs-cc: jporterbugs <at> 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'...
This bug report was last modified 275 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.