all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Phil <heller.barde@gmail.com>
To: 21321@debbugs.gnu.org
Subject: bug#21321: 24.5; sh-mode incorrectly indents case statements in certain cases
Date: Sat, 22 Aug 2015 15:49:39 +0200	[thread overview]
Message-ID: <CAG2muuPBimy84RrVbZHdsujWaDKT3pE27rzD-VruuBRSN3TUTQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 5853 bytes --]

If there is a pair of parens (for bash globbing) in a case match, the

indentation of sh-mode indents everything after the match expression to

the end of that expression. If there are multiple such expressions, it will

progressively indent further and further.


To see what I mean, load the example below into an emacs buffer with
sh-mode and press


M-x mark-whole-buffer RET M-x indent-region RET


------------- Example ----------------------

#!/bin/bash

TEST=foo234bar


###### Expected: (does not contain the offending parens)


case $TEST in

foo[0-9]bar)

echo "TEST contains a digit between foo and bar";

;;


foobar)

echo "TEST does not contain numbers";

;;


*)

echo "Invalid value in TEST";

;;

esac


###### End expected


###### Actual: (contains the parens for the repeating pattern match)


case $TEST in

foo+([0-9])bar)

echo "TEST contains numbers between foo and bar";

;;


foobar)

echo "TEST does not contain numbers";

;;


*)

echo "Invalid value in TEST";

;;

esac;



###### End actual

----------------- END Example -------------------


Thanks for looking at this


Regards,

Philip Stark





In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.2)

of 2015-04-20 on bitzer.hoetzel.info

Windowing system distributor `The X.Org Foundation', version 11.0.11702000

Configured using:

`configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib

--localstatedir=/var --with-x-toolkit=gtk3 --with-xft

'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong

--param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2

LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'


Important settings:

value of $LC_MONETARY: de_CH.UTF-8

value of $LC_NUMERIC: de_CH.UTF-8

value of $LC_TIME: de_CH.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

global-diff-hl-mode: t

diff-hl-mode: t

diff-auto-refine-mode: t

winner-mode: t

global-undo-tree-mode: t

undo-tree-mode: t

global-anzu-mode: t

anzu-mode: t

projectile-global-mode: t

projectile-mode: t

shell-dirtrack-mode: t

volatile-highlights-mode: t

global-hl-line-mode: t

recentf-mode: t

savehist-mode: t

show-smartparens-global-mode: t

show-smartparens-mode: t

global-auto-revert-mode: t

delete-selection-mode: t

prelude-global-mode: t

prelude-mode: t

tooltip-mode: t

electric-indent-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

size-indication-mode: t

column-number-mode: t

line-number-mode: t

transient-mark-mode: t


Recent messages:

Saving file /home/phil/tmp/emacs_indentation_test.sh...

Wrote /tmp/.!home!phil!tmp!emacs_indentation_test.sh.~undo-tree~

Wrote /home/phil/tmp/emacs_indentation_test.sh

Saving file /home/phil/tmp/emacs_indentation_test.sh...

Wrote /tmp/.!home!phil!tmp!emacs_indentation_test.sh.~undo-tree~

Wrote /home/phil/tmp/emacs_indentation_test.sh

byte-code: Beginning of buffer [7 times]

Making completion list...


Load-path shadows:

None found.


Features:

(shadow sort mail-extr emacsbug message idna rfc822 mml mml-sec

mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils

mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils easy-kill

vc-git sh-script smie executable help-mode server flatland-theme

prelude-global-keybindings prelude-editor operate-on-number calc-bin

calc-ext calc calc-loaddefs calc-macs diff-hl smartrep vc-dir ewoc vc

vc-dispatcher diff-mode easy-mmode winner undo-tree diff esh-var esh-io

esh-cmd esh-opt esh-ext esh-proc esh-arg eldoc esh-groups eshell

esh-module esh-mode esh-util re-builder whitespace tabify

browse-kill-ring midnight ediff-merg ediff-wind ediff-diff ediff-mult

ediff-help ediff-init ediff-util ediff dired-x dired anzu avy projectile

compile ibuf-ext ibuffer bookmark pp expand-region text-mode-expansions

er-basic-expansions expand-region-core expand-region-custom flyspell

ispell tramp tramp-compat auth-source gnus-util mm-util mail-prsvr

password-cache tramp-loaddefs trampver shell pcomplete comint ansi-color

format-spec etags ring volatile-highlights hl-line windmove recentf

tree-widget wid-edit savehist saveplace diminish edmacro kmacro

smartparens-config smartparens time-date autorevert filenotify delsel

prelude-mode prelude-core imenu epl ido ov dash thingatpt prelude-ui

smart-mode-line mule-util rich-minority prelude-custom prelude-packages

finder-inf eieio byte-opt bytecomp byte-compile cl-extra cconv

eieio-core cl-macs advice help-fns info easymenu package epg-config cl

gv cl-loaddefs cl-lib theme 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 267771 213712)

(symbols 48 38350 1)

(miscs 40 482 957)

(strings 32 70315 175298)

(string-bytes 1 1986298)

(vectors 16 30716)

(vector-slots 8 613249 119243)

(floats 8 168 1362)

(intervals 56 1105 3300)

(buffers 960 16)

(heap 1024 67464 33453))

[-- Attachment #2: Type: text/html, Size: 14044 bytes --]

                 reply	other threads:[~2015-08-22 13:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAG2muuPBimy84RrVbZHdsujWaDKT3pE27rzD-VruuBRSN3TUTQ@mail.gmail.com \
    --to=heller.barde@gmail.com \
    --cc=21321@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.