GNU bug report logs - #48193
Youngsters in charge of emacs vs. basic Bourne shell "for" statement

Previous Next

Package: emacs;

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

Date: Mon, 3 May 2021 15:08:02 UTC

Severity: minor

Tags: confirmed, patch

Merged with 2910, 21244, 26217, 30170, 46093

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 48193 in the body.
You can then email your comments to 48193 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#48193; Package emacs. (Mon, 03 May 2021 15:08: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, 03 May 2021 15:08: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: Youngsters in charge of emacs vs. basic Bourne shell "for" statement
Date: Mon, 03 May 2021 22:48:16 +0800
for i do
    true
done
    : This line and the whole rest of the program misindented because emacs shallow knowlege of shell grammar.
    : Test with TAB. Emacs only knows about:
    for i
    do
	true
    done
    : If this was python, well, you would have to have the language change to accomidate emacs.
    : Also if we are colaborating on a big project we cannot just rip up line of other peoples code so
    : they are not misindeted for only us.
    : Yes, some emacs programmers do not know shell grammar and just assume... indeed the word "do" on the
    : first line is not even in a different color. But the word in right here in this line is! Three times!
    : Hmmm, [including this part of] the sh language is, maybe 50 years
    : old. Not something checkbashisms --extra --force --posix has an issue with. It is part
    : of sh, bash, dash, ksh, ...
    : I.e., not something invented before emacs...
    : What could be even older? Well, sh must have been written in C...
    : Yes, I reported this before. But it was closed by programmers who
    : do not know basic Bourne shell "for" statement grammar.
    : emacs-version "27.1"

Indeed, I was just reading in RISKS Digest,

> https://www.wired.com/story/ai-latest-trick-writing-computer-code/

> What fun -- being second-guessed in real time by software that doesn't
> understand my code...




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.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48193; Package emacs. (Mon, 03 May 2021 15:23:02 GMT) Full text and rfc822 format available.

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

From: Gregory Heytings <gregory <at> heytings.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 48193 <at> debbugs.gnu.org
Subject: Re: bug#48193: Youngsters in charge of emacs vs. basic Bourne shell
 "for" statement
Date: Mon, 03 May 2021 15:22:31 +0000
>
> for i do
>    true
> done
>    : This line and the whole rest of the program misindented because emacs shallow knowlege of shell grammar.
>

for i in a b c; do
    true
done
# This line and the whole rest of the program correctly indented because Jidanni now knows the shell grammar




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48193; Package emacs. (Mon, 03 May 2021 15:28:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 48193 <at> debbugs.gnu.org
Subject: Re: bug#48193: Youngsters in charge of emacs vs. basic Bourne shell
 "for" statement
Date: Mon, 03 May 2021 11:27:25 -0400
Duplicate of https://debbugs.gnu.org/26217 (a normal report).
No-one need (or should) read jidanni's claptrap.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48193; Package emacs. (Mon, 03 May 2021 15:39:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 48193 <at> debbugs.gnu.org
Subject: Re: bug#48193: Youngsters in charge of emacs vs. basic Bourne shell
 "for" statement
Date: Mon, 03 May 2021 23:38:40 +0800
$ man bash
SHELL GRAMMAR
for name [ [ in [ word ... ] ] ; ] do list ; done




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48193; Package emacs. (Mon, 03 May 2021 17:14:02 GMT) Full text and rfc822 format available.

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

From: Gregory Heytings <gregory <at> heytings.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 48193 <at> debbugs.gnu.org
Subject: Re: bug#48193: Youngsters in charge of emacs vs. basic Bourne shell
 "for" statement
Date: Mon, 03 May 2021 17:13:12 +0000
>
> $ man bash
> SHELL GRAMMAR
> for name [ [ in [ word ... ] ] ; ] do list ; done
>

So what?  Of course it it's not feasible to embed a complete Bourne shell 
interpreter (or for that matter the interpreter of any language) in Emacs 
to cope with every possible exotic construct of that language.  I note 
that

for i
do
    true
done

and

for i; do
    true
done

are both indented as you expect.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48193; Package emacs. (Tue, 04 May 2021 18:27:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 48193 <at> debbugs.gnu.org
Subject: Re: bug#48193: Youngsters in charge of emacs vs. basic Bourne shell
 "for" statement
Date: Wed, 05 May 2021 02:26:08 +0800
Just like if for some language,

if(1){
        bla;
}

was dealt with fine, but

if(1)
{
        bla;
}

messed up the parenthesis counter...




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.