From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Indentation contest nxml vs xml-mode Date: Thu, 06 Mar 2008 23:38:12 +0100 Message-ID: <47D07254.9020508@gmail.com> References: <47D03AE7.8070408@gmail.com> <00a601c87fba$febc3150$0600a8c0@us.oracle.com> <47D0679F.5000001@gmail.com> <00da01c87fd8$6c881420$0600a8c0@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1204843115 10265 80.91.229.12 (6 Mar 2008 22:38:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Mar 2008 22:38:35 +0000 (UTC) Cc: Jason Rumney , 'Emacs Devel' To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 06 23:39:01 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JXOjr-00089q-Qp for ged-emacs-devel@m.gmane.org; Thu, 06 Mar 2008 23:39:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JXOjK-00021A-Ba for ged-emacs-devel@m.gmane.org; Thu, 06 Mar 2008 17:38:26 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JXOjE-0001yC-Ry for emacs-devel@gnu.org; Thu, 06 Mar 2008 17:38:20 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JXOjD-0001vw-Cf for emacs-devel@gnu.org; Thu, 06 Mar 2008 17:38:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JXOjD-0001vo-3i for emacs-devel@gnu.org; Thu, 06 Mar 2008 17:38:19 -0500 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JXOj9-0002Hn-2h; Thu, 06 Mar 2008 17:38:15 -0500 Original-Received: from c83-254-148-228.bredband.comhem.se ([83.254.148.228]:60013 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1JXOj7-00016h-6q; Thu, 06 Mar 2008 23:38:13 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: <00da01c87fd8$6c881420$0600a8c0@us.oracle.com> X-Antivirus: avast! (VPS 080306-1, 2008-03-06), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.148.228 X-ACL-Warn: Too high rate of unknown addresses received from you X-Scan-Result: No virus found in message 1JXOj7-00016h-6q. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1JXOj7-00016h-6q 2df29ab1c5aaa8be24f40db1e1e9124c X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:91559 Archived-At: Drew Adams wrote: >> ***** xml-mode >> >> >> Duh >> >> >> >> >> ***** nxml-mode >> >> >> Duh >> >> >> > > IMO, neither is great (both are ugly and confusing). I've never seen XML > indented like either of those (except when it wasn't formatted at all). > FWIW, I use this: > > > > Duh > > > > > IOW: 1. Align opening and closing tags. 2. Indent just enough so that nested > tags start after the > Why? Because (1) you need to be able to easily find corresponding tags and > (2) XML is verbose, so the less indentation the better. You could indent > only one space, but I think it's more readable with two. > > Another possibility is what we (most of us) use in Lisp - avoid starting > lines with closing tags: > > > > Duh > some more Both your suggestions looks good IMO. > That can also work well in some contexts. > > I present lots of XML in doc everyday. I haven't found anything more > readable than just indenting two spaces and aligning the corresponding > element tags. I also align attributes. But I never, ever introduce or change > significant whitespace, such as that within a text() node, if I can avoid > it. For example, I never indent the text here: > > some text that is too > long for a printed line > > That should never be changed by automatic indentation to, say, this: > > some text that is too > long for a printed line > > or this: > > some text that is too > long for a printed line > Though as Jason (I believe) pointed out when we discussed it last time whitespace is not significant (most of the time ...) in XHTML, only in XML. But it is sometimes -- and those times are really hard to detect since they might depend on the style sheet, or?