From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17570 invoked from network); 12 Aug 2006 15:29:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO,UNPARSEABLE_RELAY autolearn=ham version=3.1.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Aug 2006 15:29:17 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 78873 invoked from network); 12 Aug 2006 15:29:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Aug 2006 15:29:09 -0000 Received: (qmail 12205 invoked by alias); 12 Aug 2006 15:29:01 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10591 Received: (qmail 12196 invoked from network); 12 Aug 2006 15:29:01 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Aug 2006 15:29:01 -0000 Received: (qmail 77917 invoked from network); 12 Aug 2006 15:29:01 -0000 Received: from vms042pub.verizon.net (206.46.252.42) by a.mx.sunsite.dk with SMTP; 12 Aug 2006 15:28:59 -0000 Received: from torch.brasslantern.com ([71.121.0.226]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0J3W00EWK5NI57B0@vms042.mailsrvcs.net> for zsh-users@sunsite.dk; Sat, 12 Aug 2006 10:28:31 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id k7CFSTts001869 for ; Sat, 12 Aug 2006 08:28:29 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k7CFSSJW001868 for zsh-users@sunsite.dk; Sat, 12 Aug 2006 08:28:28 -0700 Date: Sat, 12 Aug 2006 08:28:28 -0700 From: Bart Schaefer Subject: Re: What would you say is the most-used way of indenting case labels In-reply-to: <200608111937.k7BJbfE6003802@pwslaptop.csr.com> To: "Zsh Users' List" Message-id: <060812082828.ZM1867@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <200608111937.k7BJbfE6003802@pwslaptop.csr.com> Comments: In reply to Peter Stephenson "Re: What would you say is the most-used way of indenting case labels" (Aug 11, 8:37pm) 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.