all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Karl Chen <quarl@cs.berkeley.edu>
To: Emacs Developement List <emacs-devel@gnu.org>
Subject: sh-mode indentation of "case $foo in (bar)"
Date: Fri, 31 Oct 2008 03:29:13 -0700	[thread overview]
Message-ID: <quack.20081031T0329.lth7i7pnjly@roar.cs.berkeley.edu> (raw)


emacs -Q /tmp/case.sh
#
case x in
y)
y2
;;
(z)
z2
;;
esac

M-: (indent-region (point-min) (point-max))


Result:
#
case x in
    y)
        y2
	;;
    (z)
    z2
    ;;
esac


Expected:
#
case x in
    y)
        y2
	;;
    (z)
        z2
        ;;
esac



Running (sh-get-indent-info) on the y2 line includes
sh-indent-for-case-alt in the result (as expected); running
(sh-get-indent-info) on the z2 line doesn't yield
sh-indent-for-case-alt.

The "(altpattern)" syntax with leading opening parenthesis is
supported by various shells (bash, ksh, zsh).


Also, a second indentation bug: if the first line in the buffer is
the case statement, sh-mode gets even more confused and
double-indents the y2 line.  This is rare though since usually the
first line is "#!"; I only noticed it while constructing this bug
report.

Tested on emacs 22.2 and emacs 2008-10-31.




                 reply	other threads:[~2008-10-31 10:29 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=quack.20081031T0329.lth7i7pnjly@roar.cs.berkeley.edu \
    --to=quarl@cs.berkeley.edu \
    --cc=emacs-devel@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.