GNU bug report logs - #46093
Shell-script mode formatting error eats half the page

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Mon, 25 Jan 2021 06:35:01 UTC

Severity: minor

Tags: confirmed, patch

Merged with 2910, 21244, 26217, 30170, 48193

Found in versions 25.0.95, 25.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46093 in the body.
You can then email your comments to 46093 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#46093; Package emacs. (Mon, 25 Jan 2021 06:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 25 Jan 2021 06:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Shell-script mode formatting error eats half the page
Date: Mon, 25 Jan 2021 12:40:44 +0800
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46093; Package emacs. (Wed, 27 Jan 2021 02:10:01 GMT) Full text and rfc822 format available.

Message #8 received at 46093 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 46093 <at> debbugs.gnu.org
Subject: Re: bug#46093: Shell-script mode formatting error eats half the page
Date: Wed, 27 Jan 2021 03:09:23 +0100
積丹尼 Dan Jacobson <jidanni <at> 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




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 27 Jan 2021 02:10:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 46093 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 27 Jan 2021 02:10:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46093; Package emacs. (Wed, 27 Jan 2021 17:37:02 GMT) Full text and rfc822 format available.

Message #15 received at 46093 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 46093 <at> debbugs.gnu.org
Subject: Re: bug#46093: Shell-script mode formatting error eats half the page
Date: Thu, 28 Jan 2021 01:36:40 +0800
>>>>> "LI" == Lars Ingebrigtsen <larsi <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46093; Package emacs. (Wed, 27 Jan 2021 20:09:02 GMT) Full text and rfc822 format available.

Message #18 received at 46093 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 46093 <at> debbugs.gnu.org
Subject: Re: bug#46093: Shell-script mode formatting error eats half the page
Date: Wed, 27 Jan 2021 15:08:40 -0500
FYI, dupe of https://debbugs.gnu.org/26217 (and others).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46093; Package emacs. (Thu, 28 Jan 2021 02:45:02 GMT) Full text and rfc822 format available.

Message #21 received at 46093 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 46093 <at> debbugs.gnu.org
Subject: Re: bug#46093: Shell-script mode formatting error eats half the page
Date: Thu, 28 Jan 2021 03:44:36 +0100
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

> LI>     for name [ [in [words …] ] ; ] do commands; done
>
>                                    ^^^ see, that semicolon is optional.
>                                    That's what the extra brackets mean.

Sorry; misread the specs.  Reopening (and merging with one of the other
bug reports about this).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 28 Jan 2021 02:45:02 GMT) Full text and rfc822 format available.

Forcibly Merged 2910 21244 26217 30170 46093. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 28 Jan 2021 02:46:02 GMT) Full text and rfc822 format available.

Removed tag(s) notabug. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 28 Jan 2021 09:13:02 GMT) Full text and rfc822 format available.

Forcibly Merged 2910 21244 26217 30170 46093 48193. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 03 May 2021 15:22:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Mauro Aranda <maurooaranda <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 14 Oct 2023 12:46:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 12 Nov 2023 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 179 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.