unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48193: Youngsters in charge of emacs vs. basic Bourne shell "for" statement
@ 2021-05-03 14:48 積丹尼 Dan Jacobson
  2021-05-03 15:22 ` Gregory Heytings
  0 siblings, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-05-03 14:48 UTC (permalink / raw)
  To: 48193

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...





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#48193: Youngsters in charge of emacs vs. basic Bourne shell "for" statement
  2021-05-03 14:48 bug#48193: Youngsters in charge of emacs vs. basic Bourne shell "for" statement 積丹尼 Dan Jacobson
@ 2021-05-03 15:22 ` Gregory Heytings
  2021-05-03 15:27   ` Glenn Morris
  2021-05-03 15:38   ` 積丹尼 Dan Jacobson
  0 siblings, 2 replies; 6+ messages in thread
From: Gregory Heytings @ 2021-05-03 15:22 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 48193


>
> 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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#48193: Youngsters in charge of emacs vs. basic Bourne shell "for" statement
  2021-05-03 15:22 ` Gregory Heytings
@ 2021-05-03 15:27   ` Glenn Morris
  2021-05-03 15:38   ` 積丹尼 Dan Jacobson
  1 sibling, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2021-05-03 15:27 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 48193


Duplicate of https://debbugs.gnu.org/26217 (a normal report).
No-one need (or should) read jidanni's claptrap.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#48193: Youngsters in charge of emacs vs. basic Bourne shell "for" statement
  2021-05-03 15:22 ` Gregory Heytings
  2021-05-03 15:27   ` Glenn Morris
@ 2021-05-03 15:38   ` 積丹尼 Dan Jacobson
  2021-05-03 17:13     ` Gregory Heytings
  1 sibling, 1 reply; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-05-03 15:38 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 48193

$ man bash
SHELL GRAMMAR
for name [ [ in [ word ... ] ] ; ] do list ; done





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#48193: Youngsters in charge of emacs vs. basic Bourne shell "for" statement
  2021-05-03 15:38   ` 積丹尼 Dan Jacobson
@ 2021-05-03 17:13     ` Gregory Heytings
  2021-05-04 18:26       ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 6+ messages in thread
From: Gregory Heytings @ 2021-05-03 17:13 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 48193


>
> $ 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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#48193: Youngsters in charge of emacs vs. basic Bourne shell "for" statement
  2021-05-03 17:13     ` Gregory Heytings
@ 2021-05-04 18:26       ` 積丹尼 Dan Jacobson
  0 siblings, 0 replies; 6+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-05-04 18:26 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 48193

Just like if for some language,

if(1){
        bla;
}

was dealt with fine, but

if(1)
{
        bla;
}

messed up the parenthesis counter...





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-04 18:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 14:48 bug#48193: Youngsters in charge of emacs vs. basic Bourne shell "for" statement 積丹尼 Dan Jacobson
2021-05-03 15:22 ` Gregory Heytings
2021-05-03 15:27   ` Glenn Morris
2021-05-03 15:38   ` 積丹尼 Dan Jacobson
2021-05-03 17:13     ` Gregory Heytings
2021-05-04 18:26       ` 積丹尼 Dan Jacobson

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).