Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.emacs.help > #61043 > unrolled thread

Question about change in shell mode

Started byJim Diamond <zsd@jdvb.ca>
First post2026-01-10 17:55 -0400
Last post2026-06-20 11:14 -0300
Articles 3 — 2 participants

Back to article view | Back to gnu.emacs.help


Contents

  Question about change in shell mode Jim Diamond <zsd@jdvb.ca> - 2026-01-10 17:55 -0400
    Re: Question about change in shell mode steve g <Sgonedes1977@gmail.com> - 2026-06-20 00:03 -0400
      Re: Question about change in shell mode Jim Diamond <zsd@jdvb.ca> - 2026-06-20 11:14 -0300

#61043 — Question about change in shell mode

FromJim Diamond <zsd@jdvb.ca>
Date2026-01-10 17:55 -0400
SubjectQuestion about change in shell mode
Message-ID<slrn10m5imt.3pf.zsd@x360.localdomain>
(I posted this a week or so ago in the "wrong" emacs group, and just
silence.  Maybe that one is essentially dead, so I thought I'd try here.)

In emacs 28.2 (started as "emacs -Q"), if I have a file

------------------------------------cut here---------------------
#! /bin/sh
    
while
do
done
------------------------------------cut here---------------------

and I mark the region with the (partial) while loop and then
        M-x indent-region
nothing changes.

However, in emacs 30.2, the partial while loop changes to

while
    do
done

The same thing happens with "until" loops, but not "for" loops.


Other info: with no condition, in 30.2 with the cursor at the beginning of
the "do" line, smie-config-show-indent (C-c ?) says
        Rules used: :elem basic -> 4, :after "while" -> nil
whereas in

for
do
done

(i.e., a for loop with no loop variable or list) with the cursor at the
beginning of the "do" line, smie-config-show-indent says
        Rules used: :before "do" -> 0

For the "while", Emacs 28.2's smie reports this:
        Rules used: :before "do" -> 0


Yes, I know I am missing the while condition there, and if I put it in,
emacs 30.2 behaves itself.  So I can deal with it.


My question is this: is this an intentional change in smie?  I browsed
emacs' NEWS file and didn't see anything about a functional change in smie.


                                Jim

[toc] | [next] | [standalone]


#61068

Fromsteve g <Sgonedes1977@gmail.com>
Date2026-06-20 00:03 -0400
Message-ID<874iixhn89.fsf@gmail.com>
In reply to#61043
Jim Diamond <zsd@jdvb.ca> writes:

> (I posted this a week or so ago in the "wrong" emacs group, and just
> silence.  Maybe that one is essentially dead, so I thought I'd try here.)
>
> In emacs 28.2 (started as "emacs -Q"), if I have a file
>
> ------------------------------------cut here---------------------
> #! /bin/sh
>     
> while
> do
> done
> ------------------------------------cut here---------------------
>
> and I mark the region with the (partial) while loop and then
>         M-x indent-region
> nothing changes.
>
> However, in emacs 30.2, the partial while loop changes to
>
> while
>     do
> done
>
> The same thing happens with "until" loops, but not "for" loops.
>
>
> Other info: with no condition, in 30.2 with the cursor at the beginning of
> the "do" line, smie-config-show-indent (C-c ?) says
>         Rules used: :elem basic -> 4, :after "while" -> nil
> whereas in
>
> for
> do
> done
>
> (i.e., a for loop with no loop variable or list) with the cursor at the
> beginning of the "do" line, smie-config-show-indent says
>         Rules used: :before "do" -> 0
>
> For the "while", Emacs 28.2's smie reports this:
>         Rules used: :before "do" -> 0
>
>
> Yes, I know I am missing the while condition there, and if I put it in,
> emacs 30.2 behaves itself.  So I can deal with it.
>
>
> My question is this: is this an intentional change in smie?  I browsed
> emacs' NEWS file and didn't see anything about a functional change in smie.
>
>
>                                 Jim




try running M-x normal-mode.
highlight the code and M-x indent-region should work.


> My question is this: is this an intentional change in smie?  I browsed
> emacs' NEWS file and didn't see anything about a functional change in smie.

I don't think anyone will ever try and modify shell mode. it is some scary software.
you could also try bash-ts-mode, this is new to me.

[toc] | [prev] | [next] | [standalone]


#61069

FromJim Diamond <zsd@jdvb.ca>
Date2026-06-20 11:14 -0300
Message-ID<slrn113d825.i8k.zsd@x360.localdomain>
In reply to#61068
On 2026-06-20 at 01:03 ADT, steve g <Sgonedes1977@gmail.com> wrote:
> Jim Diamond <zsd@jdvb.ca> writes:

>> (I posted this a week or so ago in the "wrong" emacs group, and just
>> silence.  Maybe that one is essentially dead, so I thought I'd try here.)

>> In emacs 28.2 (started as "emacs -Q"), if I have a file

>> ------------------------------------cut here---------------------
>> #! /bin/sh

>> while
>> do
>> done
>> ------------------------------------cut here---------------------

>> and I mark the region with the (partial) while loop and then
>> M-x indent-region
>> nothing changes.

>> However, in emacs 30.2, the partial while loop changes to

>> while
>> do
>> done

>> The same thing happens with "until" loops, but not "for" loops.


>> Other info: with no condition, in 30.2 with the cursor at the beginning of
>> the "do" line, smie-config-show-indent (C-c ?) says
>> Rules used: :elem basic -> 4, :after "while" -> nil
>> whereas in

>> for
>> do
>> done

>> (i.e., a for loop with no loop variable or list) with the cursor at the
>> beginning of the "do" line, smie-config-show-indent says
>> Rules used: :before "do" -> 0

>> For the "while", Emacs 28.2's smie reports this:
>> Rules used: :before "do" -> 0


>> Yes, I know I am missing the while condition there, and if I put it in,
>> emacs 30.2 behaves itself.  So I can deal with it.


>> My question is this: is this an intentional change in smie?  I browsed
>> emacs' NEWS file and didn't see anything about a functional change in smie.

> try running M-x normal-mode.
> highlight the code and M-x indent-region should work.

Not for me, even starting emacs with -q or -Q.

Does it work for you?

>> My question is this: is this an intentional change in smie?  I browsed
>> emacs' NEWS file and didn't see anything about a functional change in smie.

> I don't think anyone will ever try and modify shell mode. it is some
> scary software.  you could also try bash-ts-mode, this is new to me.

New to me, too.  In that case the indentation is correct (i.e., "do" is not
indented).  Since most of my scripts are zsh, that may not be the way to go
for me, but it's good to know about.

Thanks.

I was thinking this newsgroup was completely dead.  So your response was a
surprise.

                                Jim

[toc] | [prev] | [standalone]


Back to top | Article view | gnu.emacs.help


csiph-web