GNU bug report logs - #19176
24.4; sh-mode & zsh: wrong indentation for alternate forms of complex commands

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Moritz Bunkus <moritz@HIDDEN>; dated Tue, 25 Nov 2014 09:11:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Nov 2014 09:10:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 25 04:10:41 2014
Received: from localhost ([127.0.0.1]:44556 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XtC8u-0002R0-79
	for submit <at> debbugs.gnu.org; Tue, 25 Nov 2014 04:10:41 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37239)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <moritz@HIDDEN>) id 1XtC8o-0002Qd-OX
 for submit <at> debbugs.gnu.org; Tue, 25 Nov 2014 04:10:37 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <moritz@HIDDEN>) id 1XtC8i-0000Vc-0P
 for submit <at> debbugs.gnu.org; Tue, 25 Nov 2014 04:10:33 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:53038)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <moritz@HIDDEN>) id 1XtC8h-0000VY-UT
 for submit <at> debbugs.gnu.org; Tue, 25 Nov 2014 04:10:27 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38951)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <moritz@HIDDEN>) id 1XtC8c-0008S7-RG
 for bug-gnu-emacs@HIDDEN; Tue, 25 Nov 2014 04:10:27 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <moritz@HIDDEN>) id 1XtC8X-0000UH-LW
 for bug-gnu-emacs@HIDDEN; Tue, 25 Nov 2014 04:10:22 -0500
Received: from tecumseh.linet-services.de ([2a01:4f8:120:5442::2]:35417)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <moritz@HIDDEN>) id 1XtC8X-0008UB-BB
 for bug-gnu-emacs@HIDDEN; Tue, 25 Nov 2014 04:10:17 -0500
Received: from spector.linet-services.de (spector-smtp-out.linet-services.de
 [IPv6:2001:6f8:13dc:8:1:3002:1:1])
 by tecumseh.linet-services.de (Postfix) with ESMTPS id BDAEAF80005
 for <bug-gnu-emacs@HIDDEN>; Tue, 25 Nov 2014 09:45:02 +0100 (CET)
Received: from adelphi.linet-services.de (adelphi.linet-services.de
 [212.60.251.2])
 by spector.linet-services.de (Postfix) with ESMTPS id 35BD4206DFF
 for <bug-gnu-emacs@HIDDEN>; Tue, 25 Nov 2014 09:45:02 +0100 (CET)
Received: from chai-latte.bs.linet-services.de ([10.199.92.2]:46488)
 by adelphi.linet-services.de with esmtp (Exim 4.82_1-5b7a7c0-XX)
 (envelope-from <moritz@HIDDEN>) id 1XtBk3-00063a-2Q
 for bug-gnu-emacs@HIDDEN; Tue, 25 Nov 2014 09:44:59 +0100
Received: by chai-latte.bs.linet-services.de (Postfix, from userid 30002)
 id AE2AE2C7015; Tue, 25 Nov 2014 09:44:59 +0100 (CET)
From: Moritz Bunkus <moritz@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.4; sh-mode & zsh: wrong indentation for alternate forms of complex
 commands
Date: Tue, 25 Nov 2014 09:44:59 +0100
Message-ID: <cullhmzwtx0.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.1 (----)

Hey,

Emacs' sh-mode when used for zsh scripts doesn't understand zsh's
alternate forms for complex commands[1]. This leads to the indentation
being completely wrong after using one such command. For example:

----------------------------------------
#!/bin/zsh

if [[ -z $1 ]] echo No args
   do_stuff Wrong indentation
----------------------------------------

The =C2=BBif=C2=AB ends on the same line it begins, therefore =C2=BBdo_stuf=
f=C2=AB should
not be indented at all.

Some more examples of what is wrong:

----------------------------------------
#!/bin/zsh

for arg ($@) echo argument $arg
    do_stuff Wrong indentation
----------------------------------------

or

----------------------------------------
#!/bin/zsh

while [[ -n $1 ]]; do
  if [[ $1 =3D=3D yes ]] echo oh yeah
     do_stuff Wrong indentation
----------------------------------------

Using { =E2=80=A6 } as the delimiters for the command list is not parsed
correctly either:

----------------------------------------
for arg ($@) { echo argument $arg ; cp $arg /backup/ ; }
    do_stuff Wrong indentation
----------------------------------------

and so on.

[1] http://info2html.sourceforge.net/cgi-bin/info2html-demo/info2html?%28zs=
h.info.gz%29Alternate%2520Forms%2520For%2520Complex%2520Commands

sh-mode is the original sh-script.el packaged with Emacs 24.4.1: 2.0f.

Kind regards,
mosu

In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.3)
 of 2014-10-21 on bitzer.hoetzel.info
Windowing system distributor `The X.Org Foundation', version 11.0.11602000
Configured using:
 `configure --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/usr/lib
 --localstatedir=3D/var --with-x-toolkit=3Dgtk3 --with-xft
 'CFLAGS=3D-march=3Dx86-64 -mtune=3Dgeneric -O2 -pipe -fstack-protector-str=
ong
 --param=3Dssp-buffer-size=3D4' CPPFLAGS=3D-D_FORTIFY_SOURCE=3D2
 LDFLAGS=3D-Wl,-O1,--sort-common,--as-needed,-z,relro'

Important settings:
  value of $LC_COLLATE: de_DE.UTF-8
  value of $LC_CTYPE: de_DE.UTF-8
  value of $LC_MONETARY: de_DE.UTF-8
  value of $LC_NUMERIC: de_DE.UTF-8
  value of $LC_TIME: de_DE.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Shell-script

Minor modes in effect:
  sh-electric-here-document-mode: t
  magit-auto-revert-mode: t
  ido-everywhere: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  global-edit-server-edit-mode: t
  which-function-mode: t
  global-hl-line-mode: t
  show-paren-mode: t
  winner-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-p C-a P C-g A C-p A <f11> P P q q P P M o i n , <return>
<return> C-SPC C-n C-SPC C-n C-n C-w <return> C-n C-n
C-e <return> <return> I s t SPC i m p l e m e n t i
e r t SPC z g <backspace> z g l . SPC e i n e r SPC
F i l t e r m =C3=B6 g l i c h k e i t SPC d <backspace>
n a c h SPC i h r . <return> C-p C-p C-p M-q C-n C-n
C-n C-x 5 s <return> l g <tab> <return> C-x C-s C-c
C-c C-x k <return> C-x k <return> C-x k <return> C-x
C-b C-p C-p C-p C-p C-p k k k k k x C-p C-p C-p k C-n
k x <f5> C-x C-f ~ / b i n / s s h - <return> C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n <return> <return> C-p C-p <return> <tab> C-h
v s h - i n d e n t a t i o n <return> M-x r e p o
r t <return> z s h SPC i n d e C-g M-x i n f o <return>
m z s h <return> c o n u C-s c o n <return> <return>
C-x 1 C-v C-v C-v C-v M-< u C-p C-p C-p C-p C-p C-p
<return> C-n C-n C-n C-n C-n C-n C-p C-n C-n C-n <tab>
C-p <return> <f11> M-x <up> <up> <return> C-g C-h v
m a j o r - m o d e <return> M-x r e <up> <return>

Recent messages:
Type C-x 1 to delete the help window.
Auto-saving...
Quit
Composing main Info directory...done
(zsh) Top
o is undefined
Mark saved where search started
Mark set
Quit
Type C-x 1 to delete the help window.

Load-path shadows:
/home/mbunkus/.emacs.d/site-start.d/libs/paredit hides /home/mbunkus/.emacs=
.d/elpa/paredit-20140128.1248/paredit
/home/mbunkus/.emacs.d/site-start.d/libs/apache-mode hides /usr/share/emacs=
/site-lisp/apache-mode
/home/mbunkus/.emacs.d/elpa/markdown-mode-20140819.602/markdown-mode hides =
/usr/share/emacs/site-lisp/markdown-mode/markdown-mode
/home/mbunkus/.emacs.d/site-start.d/libs/buff-menu hides /usr/share/emacs/2=
4.4/lisp/buff-menu
/home/mbunkus/.emacs.d/site-start.d/libs/cc-langs hides /usr/share/emacs/24=
.4/lisp/progmodes/cc-langs
/home/mbunkus/.emacs.d/site-start.d/libs/cc-align hides /usr/share/emacs/24=
.4/lisp/progmodes/cc-align
/home/mbunkus/.emacs.d/site-start.d/libs/cc-defs hides /usr/share/emacs/24.=
4/lisp/progmodes/cc-defs
/home/mbunkus/.emacs.d/site-start.d/libs/cc-mode hides /usr/share/emacs/24.=
4/lisp/progmodes/cc-mode
/home/mbunkus/.emacs.d/site-start.d/libs/cc-fonts hides /usr/share/emacs/24=
.4/lisp/progmodes/cc-fonts
/home/mbunkus/.emacs.d/site-start.d/libs/cc-styles hides /usr/share/emacs/2=
4.4/lisp/progmodes/cc-styles
/home/mbunkus/.emacs.d/site-start.d/libs/cc-vars hides /usr/share/emacs/24.=
4/lisp/progmodes/cc-vars
/home/mbunkus/.emacs.d/site-start.d/libs/cc-menus hides /usr/share/emacs/24=
.4/lisp/progmodes/cc-menus
/home/mbunkus/.emacs.d/site-start.d/libs/cc-cmds hides /usr/share/emacs/24.=
4/lisp/progmodes/cc-cmds
/home/mbunkus/.emacs.d/site-start.d/libs/cc-awk hides /usr/share/emacs/24.4=
/lisp/progmodes/cc-awk
/home/mbunkus/.emacs.d/elpa/flymake-0.4.16/flymake hides /usr/share/emacs/2=
4.4/lisp/progmodes/flymake
/home/mbunkus/.emacs.d/site-start.d/libs/cc-compat hides /usr/share/emacs/2=
4.4/lisp/progmodes/cc-compat
/home/mbunkus/.emacs.d/site-start.d/libs/cc-engine hides /usr/share/emacs/2=
4.4/lisp/progmodes/cc-engine
/home/mbunkus/.emacs.d/site-start.d/libs/cfengine hides /usr/share/emacs/24=
.4/lisp/progmodes/cfengine
/home/mbunkus/.emacs.d/site-start.d/libs/cperl-mode/cperl-mode hides /usr/s=
hare/emacs/24.4/lisp/progmodes/cperl-mode
/home/mbunkus/.emacs.d/site-start.d/libs/cc-bytecomp hides /usr/share/emacs=
/24.4/lisp/progmodes/cc-bytecomp
/home/mbunkus/.emacs.d/site-start.d/libs/cc-guess hides /usr/share/emacs/24=
.4/lisp/progmodes/cc-guess
/home/mbunkus/.emacs.d/site-start.d/libs/cl-lib hides /usr/share/emacs/24.4=
/lisp/emacs-lisp/cl-lib

Features:
(shadow sort mail-extr jka-compr emacsbug pp sh-script smie mule-util
flymake cc-defs cc-bytecomp sgml-mode smerge-mode mo-git-blame misearch
multi-isearch vc-git hi-lock executable footnote flyspell ispell f s
paredit two-column 70-perl cperl-mode 70-ido magit-blame dired-sort-map
dired-single magit-key-mode magit iswitchb ido esh-var esh-io esh-cmd
esh-opt esh-ext esh-proc esh-arg eldoc esh-groups eshell esh-module
esh-mode esh-util ediff-merg ediff-wind ediff-diff ediff-mult ediff-help
ediff-init ediff-util ediff dired-x dired view tramp tramp-compat
auth-source gnus-util password-cache tramp-loaddefs trampver shell
pcomplete grep compile comint epa epg diff-mode autorevert filenotify
ansi-color git-rebase-mode thingatpt git-commit-mode server log-edit
message idna sendmail format-spec rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
solarized-light-theme solarized-definitions 70-html-xml rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph
nxml-enc xmltok saveplace buff-menu+ buff-menu edit-server 70-helpers
which-func imenu dash-functional dash browse-kill-ring hl-line paren
70-text 70-tabs filladapt winner ring 01-version-test my-site-start
yasnippet advice help-fns derived easy-mmode edmacro kmacro help-mode
ack-and-a-half-autoloads ag-autoloads clojure-test-mode-autoloads
cider-autoloads dash-functional-autoloads elixir-mode-autoloads
expand-region-autoloads f-autoloads dash-autoloads flymake-autoloads
flymake-yaml-autoloads flymake-easy-autoloads gist-autoloads finder-inf
gh-autoloads eieio byte-opt bytecomp byte-compile cconv eieio-core
logito-autoloads info easymenu magit-autoloads git-rebase-mode-autoloads
git-commit-mode-autoloads markdown-mode-autoloads nrepl-autoloads
clojure-mode-autoloads paredit-autoloads pcache-autoloads
pkg-info-autoloads epl-autoloads s-autoloads tracwiki-mode-autoloads
xml-rpc-autoloads yaml-mode-autoloads package epg-config cl-macs cl gv
cl-loaddefs cl-lib 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)

Memory information:
((conses 16 429319 47075)
 (symbols 48 38141 18)
 (miscs 40 1111 3733)
 (strings 32 91728 19469)
 (string-bytes 1 2507381)
 (vectors 16 37275)
 (vector-slots 8 1438804 150917)
 (floats 8 535 694)
 (intervals 56 1735 484)
 (buffers 960 57)
 (heap 1024 53786 2991))




Acknowledgement sent to Moritz Bunkus <moritz@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#19176; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.