Subject: bug#18031: 24.3.92; bad indentation in shell script mode

From: Gilles Pion <[email-masked]>
Date: Wed, 16 Jul 2014 14:08:26 +0200

Actions to reproduce the bug:

* lauch emacs in failsafe mode ("emacs -Q")
* create a new buffer named "anythingyouwant.ksh" and insert the following lines
========= cut here ===========
#!/bin/ksh
grep -e "^$userregexp:" /etc/passwd | cut -d :  -f 1 | while read user ; do
    print -u2 "user=$user"
     sudo -U $user -ll | while read line ; do
         :
     done
done
========= cut here ===========
* M-x shell-script-mode
* M-x mark-whole-buffer
* M-x indent-region

Here's the result:

#!/bin/ksh

grep -e "^$userregexp:" /etc/passwd | cut -d :  -f 1 | while read user ; do
                                                           print -u2
"user=$user"
                                                           sudo -U
$user -ll | while read line ; do

            :

        done
                                                       done

In GNU Emacs 24.3.92.1 (powerpc-ibm-aix6.1.0.0, X toolkit)
 of 2014-07-01 on ax30001
Windowing system distributor `The Cygwin/X Project', version 11.0.11501000
Configured using:
 `configure --prefix=/<SITE>/opt/emacs-24.3.92
 --exec-prefix=/<SITE>/opt/emacs-24.3.92 --sysconfdir=/etc/<SITE>/opt/emacs
 --localstatedir=/var/<SITE>/opt/emacs --without-all --with-x-toolkit=lucid
 --with-xpm --with-x-toolkit=lucid
 --enable-locallisppath=/<SITE>/share/emacs/site-lisp 'CFLAGS=-O3 -g3'
 'CPPFLAGS=-I/<SITE>/opt/emacs-24.3.92/include -I/opt/freeware/include '
 'LDFLAGS=-L/<SITE>/opt/emacs-24.3.92/lib -Wl,-bstatic -L/opt/freeware/lib
 -lXpm -Wl,-bdynamic''

Important settings:
  value of $LANG: C
  locale-coding-system: iso-latin-1-unix

Major mode: Shell-script

Minor modes in effect:
  sh-electric-here-document-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils help-mode easymenu sh-script smie
executable dired time-date tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dynamic-setting
x-toolkit x multi-tty emacs)

Memory information:
((conses 8 87772 8428)
 (symbols 24 18605 0)
 (miscs 20 60 360)
 (strings 16 14441 4333)
 (string-bytes 1 359100)
 (vectors 8 10219)
 (vector-slots 4 413533 5420)
 (floats 8 67 336)
 (intervals 28 783 438)
 (buffers 512 16))

-- 
Gilles