unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann)
Cc: emacs-devel@gnu.org
Subject: Re: the overloading of `tab-width'
Date: Sat, 15 Jun 2002 20:57:28 +0200	[thread overview]
Message-ID: <vafofecxtd3.fsf@INBOX.auto.emacs.devel.tok.lucy.cs.uni-dortmund.de> (raw)
In-Reply-To: <1024162700.14414.578.camel@space-ghost> (Colin Walters's message of "15 Jun 2002 13:38:20 -0400")

Colin Walters <walters@gnu.org> 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)

  parent reply	other threads:[~2002-06-15 18:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-15 17:38 the overloading of `tab-width' Colin Walters
2002-06-15 18:21 ` Colin Walters
2002-06-15 18:57 ` Kai Großjohann [this message]
2002-06-16 23:28 ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vafofecxtd3.fsf@INBOX.auto.emacs.devel.tok.lucy.cs.uni-dortmund.de \
    --to=kai.grossjohann@cs.uni-dortmund.de \
    --cc=emacs-devel@gnu.org \
    /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.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).