zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.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: Sat, 12 Aug 2006 08:28:28 -0700	[thread overview]
Message-ID: <060812082828.ZM1867@torch.brasslantern.com> (raw)
In-Reply-To: <200608111937.k7BJbfE6003802@pwslaptop.csr.com>

On Aug 11,  8:37pm, Peter Stephenson wrote:
}
} Time for some audience participation.  Do you prefer the following
} style?
} 
} foo () {
}         case $1 in
}                 (a) print alpha
}                 print second
}                 print third
}                 ;;
}                 (b) print beta
}                 ;;
}                 (*) print omega
}                 ;;
}         esac
} }

No, I don't.  Case labels that short are pretty unusual, and with a
long label it'd be much harder to read.  And I prefer the second and
succeeding lines indented.  I also prefer the ;; indented, but that's
not so important.

The best thing IMO would be to use the line numbers that have already
been recorded (used in error messages and warnings) to decide when to
emit a newline, so that when you list a function or whatever you can
match the output to the error.  Lines with comments that were stripped
would be a bit of a problem; perhaps an option to print them as blank
lines, or to note the jump in line number as a comment like CPP:
# line 37

Next best (or when line numbers aren't available) would be to put the
first line on the same line as the case label only when the label is
less than N characters wide (for some value of N that makes sense,
maybe 7 if we're assuming 8-space tabs) and otherwise it goes on the
next line.  Then indent the way zsh currently does.

If that's prohibitively difficult (which I suspect it is) my next
choice is to never put anything on the same line as the case label.


  reply	other threads:[~2006-08-12 15:29 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
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 [this message]
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=060812082828.ZM1867@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).