From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-15?q?Gro=DFjohann?=) Newsgroups: gmane.emacs.devel Subject: Re: the overloading of `tab-width' Date: Sat, 15 Jun 2002 20:57:28 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: References: <1024162700.14414.578.camel@space-ghost> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1024167621 7053 127.0.0.1 (15 Jun 2002 19:00:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 15 Jun 2002 19:00:21 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17JImb-0001pd-00 for ; Sat, 15 Jun 2002 21:00:21 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17JJBy-0001n9-00 for ; Sat, 15 Jun 2002 21:26:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17JImR-0000Mp-00; Sat, 15 Jun 2002 15:00:11 -0400 Original-Received: from waldorf.cs.uni-dortmund.de ([129.217.4.42]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17JIjv-0000G4-00; Sat, 15 Jun 2002 14:57:36 -0400 Original-Received: from lothlorien.cs.uni-dortmund.de (lothlorien [129.217.19.67]) by waldorf.cs.uni-dortmund.de with ESMTP id g5FIvYb07981; Sat, 15 Jun 2002 20:57:34 +0200 (MES) Original-Received: from lucy.cs.uni-dortmund.de (lucy [129.217.19.80]) by lothlorien.cs.uni-dortmund.de id UAA26476; Sat, 15 Jun 2002 20:57:29 +0200 (MET DST) Original-Received: by lucy.cs.uni-dortmund.de (Postfix, from userid 6104) id F09973B5DF; Sat, 15 Jun 2002 20:57:28 +0200 (CEST) Original-To: Colin Walters In-Reply-To: <1024162700.14414.578.camel@space-ghost> (Colin Walters's message of "15 Jun 2002 13:38:20 -0400") Original-Lines: 52 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.3.50 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:4895 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:4895 Colin Walters writes: > Unfortunately, believe it or not, Emacs gives me no way to deal with > this. You may say, "You can just change `tab-width'", but in fact I > can't. If I set `tab-width' to 2, then everything shrinks nicely to the > left. However, I can't just hit TAB anymore to do indentation, because > CC mode decides it has to insert *four* tabs in order to make up to the > `c-basic-offset' value of 8. > > Now, your next response might be, "Why can't you just set *both* > c-basic-offset and tab-width to 2"? And the answer is because that can > change the buffer's representation on disk. For example, in the > following code: It was my impression that the problem can only be solved by introducing two kinds of indentation. When going one brace level deeper in the structure of the program, there is whitespace at the beginning of the line to indicate this. But then, there are statements which are split over several lines and the second line contains whitespace to line it up with the first. For the "brace-level" indentation, it would work to use one tab for each level and to then change the displayed width of a tab. But for the "alignment" indentation, this does not work. Consider this piece of code: if ( a == b ) { foo(a, b); // X Y } Consider the third line. The first part of whitespace comes (up to the X indicated in fourth (comment) line) is of the "indentation" kind. The second part, from X to Y, is of the "alignment" kind. I think it would be useful to teach modes about the two kinds of alignment. Then there could be a user option to use "one tab per level" for the indentation and "spaces only" for the alignment. So with a tab-width of 4, the third line in the example would start with one tab (for the brace level), and four spaces. What do people think? This change is not easy, since every mode has to be changed separately. kai -- ~/.signature is: umop 3p!sdn (Frank Nobis)