zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: "Zsh Users' List" <zsh-users@sunsite.dk>
Subject: Re: What would you say is the most-used way of indenting case labels
Date: Fri, 11 Aug 2006 12:10:56 +0100	[thread overview]
Message-ID: <200608111110.k7BBAuwM017362@news01.csr.com> (raw)
In-Reply-To: <dbfc82860608110354g5daf7b95hf23f86fc8f744ecb@mail.gmail.com>

"Nikolai Weibull" wrote:
> That is, is this style:
> 
> case something in
> (*ome*)
>   ... ;;
> esac
> 
> more common than
> 
> case something in
>   (*ome*)
>     ... ;;
> esac

I use Emacs sh-script mode and I end up with things looking like this

case foo in
  (bar)
  do_foo_bar
  ;;

  (rod)
  do_foo_rod
  ;;
esac

which is pretty much your second option, except there's no additional
indentation after the test and the separate ;; serves
as a visual end marker (like a "break" in C).  The zsh code seems to be
full of things like:

case foo in
  (bar)
    do_foo_bar
    ;;
  (rod)
    do_foo_rod
    ;;
esac

sometimes with a space between the ;; and the next test, sometimes without,
sometimes with the ;; level with the test, sometimes indented as shown.
However, there are other variations, too, including having the ";:" on the
same line as the last chunk of code, which seems to be more common when
there's only one line of executable code (which then sometimes appears on
the line with the test).

The only consensus seems to be the "(bar)" test is indented from the
"case".

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


  reply	other threads:[~2006-08-11 11:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-11 10:54 Nikolai Weibull
2006-08-11 11:10 ` Peter Stephenson [this message]
2006-08-11 12:47   ` Nikolai Weibull
2006-08-11 12:48     ` Nikolai Weibull
2006-08-11 14:22 ` Phil Pennock
2006-08-11 19:37   ` Peter Stephenson
2006-08-12 15:28     ` Bart Schaefer
2006-08-12 16:44     ` Wayne Davison
2006-08-13 14:17       ` Phil Pennock

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=200608111110.k7BBAuwM017362@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-users@sunsite.dk \
    /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 public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).