* M-x indent-region not working (?)
@ 2003-08-08 17:36 guanxi
2003-08-08 19:03 ` Kai Großjohann
2003-08-08 20:10 ` Barry Margolin
0 siblings, 2 replies; 9+ messages in thread
From: guanxi @ 2003-08-08 17:36 UTC (permalink / raw)
Thanks in advance for any help; I'm just learning my way around Emacs,
but I reviewed much of the documentation and postings and can't find
an answer.
M-x indent-region (or C-M-\) doesn't seem to behave per the manual:
"C-M-\ (indent-region) applies to all the lines that begin in the
region; it indents each line in the "usual" way, as if you had typed
TAB at the beginning of the line."
www.gnu.org/manual/emacs/html_node/emacs_230.html
In text mode, if I select these regions and type C-M-\, I get the
following results. In none of these examples does Emacs behave as if
I typed TAB at the beginning of each line -- is there somthing I
misunderstand?
#1
* REGION:
Dan generally uses two computers. He has a Dell in his office and
uses the Compaq that is placed behind me in the "reception" area when
his computer is slow or he wants to print to printer west.
* RESULTS
[No change at all. The Emacs cursor stops blinking for a moment, but
that's it.]
#2
* REGION
testing indenting
this region
which uses tab indents
* RESULTS
testing indenting
this region
which uses tab indents
#3
* REGION (some notes I took)
type: C-M-\
does nothing
type: M-x indent region
displays: You can run the command 'indent-region' with C-M-\
type: C-M-o
works: (move remainder of line directly down a line)
* RESULTS
type: C-M-\
does nothing
type: M-x indent region
displays: You can run the command 'indent-region' with C-M-\
type: C-M-o
works: (move remainder of line directly down a line)
My system:
WinXP Pro
GNU Emacs 21.2.1 (i386-msvc-nt5.1.2600) of 2002-03-19 on buffy
Thanks again!
guanxi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-x indent-region not working (?)
2003-08-08 17:36 M-x indent-region not working (?) guanxi
@ 2003-08-08 19:03 ` Kai Großjohann
2003-08-11 14:56 ` guanxi
2003-08-08 20:10 ` Barry Margolin
1 sibling, 1 reply; 9+ messages in thread
From: Kai Großjohann @ 2003-08-08 19:03 UTC (permalink / raw)
guanxi_i@yahoo.com (guanxi) writes:
> M-x indent-region (or C-M-\) doesn't seem to behave per the manual:
> "C-M-\ (indent-region) applies to all the lines that begin in the
> region; it indents each line in the "usual" way, as if you had typed
> TAB at the beginning of the line."
> www.gnu.org/manual/emacs/html_node/emacs_230.html
>
>
> In text mode, if I select these regions and type C-M-\, I get the
> following results. In none of these examples does Emacs behave as if
> I typed TAB at the beginning of each line -- is there somthing I
> misunderstand?
The wording in the manual is somewhat sloppy, I guess. Hm.
Is it important for you to get it working correctly in this case, or
are you just doing this to understand what's going on? In
programming language modes, like C mode, C-M-\ does what you'd expect
from the documentation.
--
Two cafe au lait please, but without milk.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-x indent-region not working (?)
2003-08-08 17:36 M-x indent-region not working (?) guanxi
2003-08-08 19:03 ` Kai Großjohann
@ 2003-08-08 20:10 ` Barry Margolin
2003-08-11 15:03 ` guanxi
1 sibling, 1 reply; 9+ messages in thread
From: Barry Margolin @ 2003-08-08 20:10 UTC (permalink / raw)
In article <6d7a61c9.0308080936.244dbc97@posting.google.com>,
guanxi <guanxi_i@yahoo.com> wrote:
>In text mode, if I select these regions and type C-M-\, I get the
>following results. In none of these examples does Emacs behave as if
>I typed TAB at the beginning of each line -- is there somthing I
>misunderstand?
What is it you really want to accomplish? Maybe indent-rigidly is the
function you really want.
--
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-x indent-region not working (?)
2003-08-08 19:03 ` Kai Großjohann
@ 2003-08-11 14:56 ` guanxi
0 siblings, 0 replies; 9+ messages in thread
From: guanxi @ 2003-08-11 14:56 UTC (permalink / raw)
kai.grossjohann@gmx.net (Kai Großjohann) wrote in message news:<84r83wt1jl.fsf@slowfox.is.informatik.uni-duisburg.de>...
> guanxi_i@yahoo.com (guanxi) writes:
>
> > M-x indent-region (or C-M-\) doesn't seem to behave per the manual:
> > "C-M-\ (indent-region) applies to all the lines that begin in the
> > region; it indents each line in the "usual" way, as if you had typed
> > TAB at the beginning of the line."
> > www.gnu.org/manual/emacs/html_node/emacs_230.html
> >
> >
> > In text mode, if I select these regions and type C-M-\, I get the
> > following results. In none of these examples does Emacs behave as if
> > I typed TAB at the beginning of each line -- is there somthing I
> > misunderstand?
>
> The wording in the manual is somewhat sloppy, I guess. Hm.
>
> Is it important for you to get it working correctly in this case, or
> are you just doing this to understand what's going on? In
> programming language modes, like C mode, C-M-\ does what you'd expect
> from the documentation.
I use Emacs for text editing (in English). Indenting a block of text
would be very useful.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-x indent-region not working (?)
2003-08-08 20:10 ` Barry Margolin
@ 2003-08-11 15:03 ` guanxi
2003-08-11 16:13 ` Stefan Monnier
2003-08-11 18:12 ` Alan Mackenzie
0 siblings, 2 replies; 9+ messages in thread
From: guanxi @ 2003-08-11 15:03 UTC (permalink / raw)
Barry Margolin <barry.margolin@level3.com> wrote in message news:<IsTYa.58$7R.33@news.level3.com>...
> In article <6d7a61c9.0308080936.244dbc97@posting.google.com>,
> guanxi <guanxi_i@yahoo.com> wrote:
> >In text mode, if I select these regions and type C-M-\, I get the
> >following results. In none of these examples does Emacs behave as if
> >I typed TAB at the beginning of each line -- is there somthing I
> >misunderstand?
>
> What is it you really want to accomplish? Maybe indent-rigidly is the
> function you really want.
indent-rigidly might be a workaround, but it's cumbersome for a few reasons:
- It doesn't do indent-relative, which is what I really need
- Using the numeric argument (which defaults to 1), it takes many keystrokes
What *is* indent-region doing? Can anyone define it?
Thanks for your help; it is much appreciated.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-x indent-region not working (?)
2003-08-11 15:03 ` guanxi
@ 2003-08-11 16:13 ` Stefan Monnier
2003-08-12 18:45 ` Kai Großjohann
2003-08-11 18:12 ` Alan Mackenzie
1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2003-08-11 16:13 UTC (permalink / raw)
> What *is* indent-region doing?
Nothing useful in this case.
I've tried to improve it in the CVS trunk, so you might want to try
it there to see if you like it better.
I suspect it still won't be of much use: it's difficult to know what
indent-region should do in text-mode anyway.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-x indent-region not working (?)
2003-08-11 15:03 ` guanxi
2003-08-11 16:13 ` Stefan Monnier
@ 2003-08-11 18:12 ` Alan Mackenzie
2003-08-12 2:12 ` guanxi
1 sibling, 1 reply; 9+ messages in thread
From: Alan Mackenzie @ 2003-08-11 18:12 UTC (permalink / raw)
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").
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-x indent-region not working (?)
2003-08-11 18:12 ` Alan Mackenzie
@ 2003-08-12 2:12 ` guanxi
0 siblings, 0 replies; 9+ messages in thread
From: guanxi @ 2003-08-12 2:12 UTC (permalink / raw)
> 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?
Outline mode may accomplish what I want; I'll try it.
I'm trying to apply indent-relative to more than one line of text, to
align it with text above.
Should I submit a bug regarding the manual's confusing description?
If so, where -- gnu.emcas.bugs?
Thank you all for all your help. I haven't coded for over a decade,
but I'm just starting to use Emacs as a text editor and find it very
efficient.
guanxi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: M-x indent-region not working (?)
2003-08-11 16:13 ` Stefan Monnier
@ 2003-08-12 18:45 ` Kai Großjohann
0 siblings, 0 replies; 9+ messages in thread
From: Kai Großjohann @ 2003-08-12 18:45 UTC (permalink / raw)
"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> 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
indent-relative.
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.
Hm.
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-08-12 18:45 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-08 17:36 M-x indent-region not working (?) guanxi
2003-08-08 19:03 ` Kai Großjohann
2003-08-11 14:56 ` guanxi
2003-08-08 20:10 ` Barry Margolin
2003-08-11 15:03 ` guanxi
2003-08-11 16:13 ` Stefan Monnier
2003-08-12 18:45 ` Kai Großjohann
2003-08-11 18:12 ` Alan Mackenzie
2003-08-12 2:12 ` guanxi
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).