[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: M-x indent-region not working (?)

From: Kai Großjohann
Subject: Re: M-x indent-region not working (?)
Date: Tue, 12 Aug 2003 20:45:15 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

"Stefan Monnier" <> writes:

> I suspect it still won't be of much use: it's difficult to know what
> indent-region should do in text-mode anyway.

Well, there was talk about indent-region doing like TAB on each
line.  That's a pretty good behavior even when TAB is bound to

The above is fairly obvious for the case when all lines are
flush-left to begin with, but for programming languages indentation
can also mean to shift towards the left, which indent-relative
doesn't do.


Here is an algorithm that describes useful behavior for indent-region
together with indent-relative as the indentation function.  It
assumes that the region does not start or end in the middle of a line.

    * Go to beginning of first line in region.

    * Do back-to-indentation.

    * Remember current column.  Do indent-relative.  Now look by how
      many columns point has moved and call that number of columns N.

    * Do indent-rigidly on the other lines in the region, specifying
      N as ARG (the number of columns to indent).

I guess that this behavior does not fit into the current
indent-region framework.  Hm.
Two cafe au lait please, but without milk.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]