GNU bug report logs - #22341
shell-script indents lines following "cmd &| while" wrong

Previous Next

Package: emacs;

Reported by: Ian Kelling <ian <at> iankelling.org>

Date: Sun, 10 Jan 2016 01:28:02 UTC

Severity: minor

Tags: notabug

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22341 in the body.
You can then email your comments to 22341 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#22341; Package emacs. (Sun, 10 Jan 2016 01:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ian Kelling <ian <at> iankelling.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 10 Jan 2016 01:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ian Kelling <ian <at> iankelling.org>
To: bug-gnu-emacs <at> gnu.org
Subject: shell-script indents lines following "cmd &| while" wrong
Date: Sat, 09 Jan 2016 17:27:21 -0800
cmd and done should be indented the same:

cmd |& asdf; while read line; do
                 cmd
             done

cmd 2>&1 | while read line; do
    cmd
done




In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.6)
 of 2016-01-09 built on treetowl
Repository revision: 384cf23c6ed05e1f151032958a2cc2bb8100344b
Windowing system distributor 'The X.Org Foundation', version
11.0.11800000
System Description:     Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man
 --pdfdir=/usr/share/doc/emacs/pdf --with-sound=alsa --without-gconf
 --with-x-toolkit=gtk3 --with-xft 'CFLAGS=-march=x86-64 -mtune=generic
 -O2 -pipe -fstack-protector-strong' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11

Important settings:
  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
  tooltip-mode: t
  global-eldoc-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 messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Setting up indent for shell type bash
Indentation variables are now local.
Indentation setup for shell type bash
Mark set
Indenting region...done
t
delete-backward-char: Text is read-only [2 times]
Quit

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired dired-loaddefs
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 seq byte-opt gv
bytecomp byte-compile cconv cl-extra help-mode easymenu cl-loaddefs
pcase cl-lib sh-script smie executable time-date mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev obarray minibuffer cl-preloaded 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 dbusbind inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 94001 5963)
 (symbols 48 20120 0)
 (miscs 40 47 107)
 (strings 32 17021 4462)
 (string-bytes 1 500205)
 (vectors 16 12561)
 (vector-slots 8 443666 4885)
 (floats 8 158 239)
 (intervals 56 261 0)
 (buffers 976 12)
 (heap 1024 35726 1091))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22341; Package emacs. (Thu, 12 May 2022 12:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 22341 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Ian Kelling <ian <at> iankelling.org>
Cc: 22341 <at> debbugs.gnu.org
Subject: Re: bug#22341: shell-script indents lines following "cmd &| while"
 wrong
Date: Thu, 12 May 2022 14:36:23 +0200
Ian Kelling <ian <at> iankelling.org> writes:

> cmd and done should be indented the same:
>
> cmd |& asdf; while read line; do
>                  cmd
>              done
>
> cmd 2>&1 | while read line; do
>     cmd
> done

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

This is by design, if I skim the code correctly.  In the first case, we
have two commands separated by a semicolon, so shell-script-mode will
use the semicolon as the base of the indentation.

In the second instance we have "one command", so it's indenting from the
start of the line.

So this seems to be working as designed, and I'm therefore closing this
bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 12 May 2022 12:37:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 22341 <at> debbugs.gnu.org and Ian Kelling <ian <at> iankelling.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 12 May 2022 12:37:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 10 Jun 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 31 days ago.

Previous Next


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