* bug#46093: Shell-script mode formatting error eats half the page
@ 2021-01-25 4:40 積丹尼 Dan Jacobson
2021-01-27 2:09 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-01-25 4:40 UTC (permalink / raw)
To: 46093
Here we observe lines severely shoved over due to Shell-script mode not
recognizing the statement has terminated. emacs-version "27.1".
$ cat x.sh
set /home/$j/.adobe /home/$j/.macromedia && for i do if test -d $i; then rm -vr $i; fi; done
echo these lines are now indented wrongly
echo these lines are now indented wrongly for the rest of the file.
echo There is no recovery.
"Well then use if ...; then ..."
if set /home/$j/.adobe /home/$j/.macromedia
then for i do if test -d $i; then rm -vr $i; fi; done
fi #UH OH, STILL MESSED UP
set /home/$j/.procmail/backup #UH OH EVEN MORE
if ! test -d $1 #AT LEAST INDENTING HAS STABILIZED finally
if set /home/$j/.adobe /home/$j/.macromedia
then
for i do if test -d $i; then rm -vr $i; fi; done
fi #STILL BAD
if set /home/$j/.adobe /home/$j/.macromedia
then
for i
do if test -d $i; then rm -vr $i; fi; done
fi #AH, FINALLY it has come to its senses.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#46093: Shell-script mode formatting error eats half the page
2021-01-25 4:40 bug#46093: Shell-script mode formatting error eats half the page 積丹尼 Dan Jacobson
@ 2021-01-27 2:09 ` Lars Ingebrigtsen
2021-01-27 17:36 ` 積丹尼 Dan Jacobson
2021-01-27 20:08 ` Glenn Morris
0 siblings, 2 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-27 2:09 UTC (permalink / raw)
To: 積丹尼 Dan Jacobson; +Cc: 46093
積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:
> Here we observe lines severely shoved over due to Shell-script mode not
> recognizing the statement has terminated. emacs-version "27.1".
>
> $ cat x.sh
> set /home/$j/.adobe /home/$j/.macromedia && for i do if test -d $i; then rm -vr $i; fi; done
> echo these lines are now indented wrongly
> echo these lines are now indented wrongly for the rest of the file.
> echo There is no recovery.
Here's a simpler reproducer:
for i do; if test -d $i; then rm -vr $i; fi; done
echo these lines are now indented wrongly
echo these lines are now indented wrongly for the rest of the file.
echo There is no recovery.
This indents correctly, though:
for i; do if test -d $i; then rm -vr $i; fi; done
echo these lines are now indented wrongly
echo these lines are now indented wrongly for the rest of the file.
echo There is no recovery.
(I moved the semicolon to before the "do", not after. Which is
apparently the correct syntax according to
https://www.gnu.org/software/bash/manual/bash.html#Compound-Commands
for
The syntax of the for command is:
for name [ [in [words …] ] ; ] do commands; done
So Emacs seems to do the correct thing here; closing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#46093: Shell-script mode formatting error eats half the page
2021-01-27 2:09 ` Lars Ingebrigtsen
@ 2021-01-27 17:36 ` 積丹尼 Dan Jacobson
2021-01-28 2:44 ` Lars Ingebrigtsen
2021-01-27 20:08 ` Glenn Morris
1 sibling, 1 reply; 5+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-01-27 17:36 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 46093
>>>>> "LI" == Lars Ingebrigtsen <larsi@gnus.org> writes:
LI> (I moved the semicolon to before the "do", not after. Which is
LI> apparently the correct syntax according to
My example had no semicolon, not before, not after.
LI> for name [ [in [words …] ] ; ] do commands; done
^^^ see, that semicolon is optional.
That's what the extra brackets mean.
LI> So Emacs seems to do the correct thing here; closing.
Well, yes, if everybody always used the optional semicolon, you might say.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#46093: Shell-script mode formatting error eats half the page
2021-01-27 2:09 ` Lars Ingebrigtsen
2021-01-27 17:36 ` 積丹尼 Dan Jacobson
@ 2021-01-27 20:08 ` Glenn Morris
1 sibling, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2021-01-27 20:08 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 46093
FYI, dupe of https://debbugs.gnu.org/26217 (and others).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-28 2:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-25 4:40 bug#46093: Shell-script mode formatting error eats half the page 積丹尼 Dan Jacobson
2021-01-27 2:09 ` Lars Ingebrigtsen
2021-01-27 17:36 ` 積丹尼 Dan Jacobson
2021-01-28 2:44 ` Lars Ingebrigtsen
2021-01-27 20:08 ` Glenn Morris
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.