Subject: bug#16015: 24.3.50; newline indents in shell script mode

From: Jarek Czekalski <[email-masked]>
Date: Sat, 30 Nov 2013 23:01:19 +0100

Steps to reproduce:
emacs -Q
C-x C-f test.sh
type "if [[ 1 ]]; then"
M-x newline

Expected behaviour: a new line indented with left margin (column 0).
Found: a new line is indented by four spaces, as if newline-and-indent
command was executed.

I checked "newline" documentation and found no explanation for that.

In GNU Emacs 24.3.50.12 (i686-pc-linux-gnu, GTK+ Version 3.8.6)
  of 2013-11-30 on jcdeb
Bzr revision: 115317 [email-masked]
Windowing system distributor `The X.Org Foundation', version 11.0.11403000
System Description:    Debian GNU/Linux unstable (sid)

Important settings:
   value of $LC_ALL: en_US
   value of $LANG: pl_PL
   locale-coding-system: iso-latin-1-unix
   default enable-multibyte-characters: t

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

Recent input:
C-x C-f t e s t . s h <return> i f SPC [ [ SPC 1 SPC
] ] ; SPC t h e n <return> <backspace> <backspace>
<backspace> <backspace> <backspace> M-x n e w l i n
e <return> <backspace> <backspace> <backspace> <backspace>
<backspace> M-x n e w l i n e - a n d <tab> <return>
M-x n e w l i n e - <escape> <escape> <escape> C-h
f n e w l i n e - a n d <tab> <return> C-x C-c <escape>
<escape> <escape> <help-echo> n n o <return> M-x r
e p o r t <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
Setting up indent for shell type sh
Indentation variables are now local.
Indentation setup for shell type sh
You can run the command `newline' with RET
Quit
Type C-x 1 to delete the help window.
Type C-h for help. [3 times]

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
mail-prsvr mail-utils help-mode easymenu help-fns sh-script smie
executable 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 dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)