From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7342 invoked from network); 11 Aug 2006 19:38:06 -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 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; 11 Aug 2006 19:38:06 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 39630 invoked from network); 11 Aug 2006 19:37:55 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Aug 2006 19:37:55 -0000 Received: (qmail 23703 invoked by alias); 11 Aug 2006 19:37:47 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10590 Received: (qmail 23693 invoked from network); 11 Aug 2006 19:37:47 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 11 Aug 2006 19:37:47 -0000 Received: (qmail 38582 invoked from network); 11 Aug 2006 19:37:47 -0000 Received: from mtaout02-winn.ispmail.ntl.com (81.103.221.48) by a.mx.sunsite.dk with SMTP; 11 Aug 2006 19:37:45 -0000 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20060811193744.HHYT27023.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Fri, 11 Aug 2006 20:37:44 +0100 Received: from pwslaptop.csr.com ([81.107.41.155]) by aamtaout02-winn.ispmail.ntl.com with ESMTP id <20060811193744.PHAA23938.aamtaout02-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Fri, 11 Aug 2006 20:37:44 +0100 Received: from pwslaptop.csr.com (pwslaptop.csr.com [127.0.0.1]) by pwslaptop.csr.com (8.13.7/8.13.7) with ESMTP id k7BJbfE6003802 for ; Fri, 11 Aug 2006 20:37:42 +0100 Message-Id: <200608111937.k7BJbfE6003802@pwslaptop.csr.com> From: Peter Stephenson To: "Zsh Users' List" Subject: Re: What would you say is the most-used way of indenting case labels In-Reply-To: Message from Phil Pennock of "Fri, 11 Aug 2006 16:22:25 +0200." <20060811142225.GA15429@parhelion.globnix.org> Date: Fri, 11 Aug 2006 20:37:41 +0100 Phil Pennock wrote: > % function foo { case $1 in (a) print alpha; print second; print third;; > (b) print beta;; (*) print omega;;esac } > > % whence -f foo > foo () { > case $1 in > (a) print alpha > print second > print third ;; > (b) print beta ;; > (*) print omega ;; > esac > } 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 } Vote now. Lines are open. Index: Src/text.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/text.c,v retrieving revision 1.16 diff -u -r1.16 text.c --- Src/text.c 10 Jan 2006 16:57:06 -0000 1.16 +++ Src/text.c 11 Aug 2006 19:33:59 -0000 @@ -530,14 +530,14 @@ taddstr(ecgetstr(state, EC_NODUP, NULL)); state->pc++; taddstr(") "); - tindent++; n = tpush(code, 0); n->u._case.end = end; n->pop = (state->pc - 2 + WC_CASE_SKIP(code) >= end); } } else if (state->pc < s->u._case.end) { - tindent--; - taddstr(WC_CASE_TYPE(code) == WC_CASE_OR ? " ;;" : ";&"); + if (tnewlins) + taddnl(); + taddstr(WC_CASE_TYPE(code) == WC_CASE_OR ? ";;" : ";&"); if (tnewlins) taddnl(); else @@ -547,13 +547,13 @@ taddstr(ecgetstr(state, EC_NODUP, NULL)); state->pc++; taddstr(") "); - tindent++; s->code = code; s->pop = ((state->pc - 2 + WC_CASE_SKIP(code)) >= s->u._case.end); } else { - tindent--; - taddstr(WC_CASE_TYPE(code) == WC_CASE_OR ? " ;;" : ";&"); + if (tnewlins) + taddnl(); + taddstr(WC_CASE_TYPE(code) == WC_CASE_OR ? ";;" : ";&"); tindent--; if (tnewlins) taddnl(); -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/