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

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

Re: simple editor required


From: Paul Edwards
Subject: Re: simple editor required
Date: Tue, 24 Jun 2003 22:26:03 GMT

"Kai Großjohann" <address@hidden> wrote in message news:address@hidden
> "Paul Edwards" <address@hidden> writes:
>
> > "Kai Großjohann" <address@hidden> wrote in message news:address@hidden
> >> "Paul Edwards" <address@hidden> writes:
> >>
> >> > It is.  The "maybe" means it doesn't always indent.  And it
> >> > shouldn't, when it is quite obvious the user already has text
> >> > on that line, and doesn't need it indented.  If they had wanted
> >> > it indented, they would have pressed tab, not enter.
> >>
> >> Huh?  I find it really convenient that I can just hit TAB (my binding
> >> for indent-relative) at the beginning of a line to increase its
> >> indentation.
> >
> > But that's what I just said.  You'd press TAB, not enter.
> > TAB is logical, enter is not.  No-one expects enter, at
> > the beginning of a line, to go to a newline and indent
> > the existing text.  enter doesn't do that sort of thing.  It
> > does start a newline, beginning under the previous one
> > though.  That is logical and reasonable.
>
> But the fact that RET does newline and then does like TAB is your own
> customization!  So you can't blame Emacs that it is doing what you
> told it to do.

Well in that case I am blaming emacs for not coming with a
"logical indentation mode", e.g. (indent-text-properly 1)
which is preferably enabled by default.  I didn't specifically
want RET bound to newline-and-strange-indent, what I
wanted was logical indentation.

> That said, I understand that the behavior of RET that you see in
> text-mode is not the best behavior.  Clearly it should be changed.

Thanks for agreeing!  What's more surprising is that 10%
of the user base didn't report this 10 years ago, and thus
was fixed years before I they installed 20.7.1 on this box.

> >> > Indentation is meant to apply to a NEW line, not an existing
> >> > line.  It's meant to put blanks there ready for you to optionally
> >> > start typing real characters, and then delete them later if they
> >> > are not already there.
> >>
> >> I use it for existing lines, too.
> >
> > You don't hit enter at the beginning of a line of text, and expect
> > it to insert a newline and indent the current text.
>
> Actually, I've never minded until now.
>
> But I see how it would be strange in text mode.  But in text mode,
> indentation is not done very often.  I have told Emacs that RET
> invokes newline-and-indent in programming modes (C, Java, Perl, ...)
> whereas it does just newline in other modes, like text.

I am mostly using text mode to write C code.  I expect text
mode to allow me to hop in and start changing C code,
regardless of the existing style of the C code.

> [time passes]
>
> Oh, now I remember that I sent a bug report about newline-and-indent
> in text mode, some years back.  Whee.  Yeah.  I guess Emacs just
> doesn't like you to use newline-and-indent in text-like modes :-)

Is there any mode I can switch too, where I can get the behaviour
I want, without it making a whole set of new problems for me
(e.g. automatic assumptions about C coding style).  The only
assumption I want is that it is indented text, so if the previous
line started in column 16, then the cursor should be positioned
there when I start a new line.

> FWIW, I get by with just newline quite nicely.  For the kind of text
> I write, indentation is not often required.

Remember that doctor's and dentist's appointment?  I really
do have that stuff, in a big file called "notes.txt" and that is
how I indent too.

But more importantly I need it for my C code.

> >> > It is not meant to trash existing lines!  Nor is it meant to get
> >> > so confused on the first line, that it just indents 8 spaces, even
> >> > when my tab setting is 4, and there's not even a prior line to
> >> > inspire it to do something that silly.
> >>
> >> That might be a misconfiguration on your part.  (Not that I blame you;
> >> the subject is complex.)  indent-relative looks at tab-stop-list and
> >> configuring tab-width is not going to have the effect you might
> >> expect.  (tab-width refers to how tab characters in the text are
> >> displayed, but the TAB key does not always insert tab characters.)
> >
> > So it sometimes (ie at beginning of file) looks at tab-stop-list,
> > and everywhere else it looks at the indentation of the previous
> > line.  Seems very strange to me.
>
> Hm.  I was going to answer that indent-relative does that, but in
> fact indent-relative-maybe also has this strange behavior in the
> first line of the file.  I think that might be a bug.

Ok.

> Note that indent-relative goes by tab-stop-list after the end of the
> previous line, whereas indent-relative-maybe does not do that.

Ok.  Hopefully with your latest lisp stuff I will finally get the
basic editting that I am after.

BFN.  Paul.




reply via email to

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