help-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Alan Mackenzie
Subject: Re: M-x indent-region not working (?)
Date: Mon, 11 Aug 2003 18:12:03 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

guanxi <guanxi_i@yahoo.com> wrote on 11 Aug 2003 08:03:07 -0700:

> What *is* indent-region doing?  Can anyone define it?

indent-region is really for indenting in _programming_ modes.  For
example, after doing a bit of yanking in some Emacs lisp code, a code
fragment might look like this:

        (if (> count 0)
   (if (< (point) here)
     (setq count (1- count))
     (goto-char (car range))
              (setq range nil))

The middle three lines need to be indented further to the right than the
first line.  Correcting indentation by hand (as has to be done in many
proprietary "programmers'" editors) is mind-numbingly tedious.  By
setting the region around these lines and doing indent-region (with the
keys C-M-\) it would end up looking like this, as it should:

        (if (> count 0)
            (if (< (point) here)
                (setq count (1- count))
              (goto-char (car range))
              (setq range nil))

It's difficult to see exactly what you're expecting indent-region to do
in a text mode, since text doesn't have an indentation structure like
programming languages do.  Could it be you're looking for something like
Outline Mode?

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").



reply via email to

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