* 'smart' indentation
@ 2003-03-09 23:06 Michael Powe
2003-03-10 0:26 ` Johan Bockgård
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Michael Powe @ 2003-03-09 23:06 UTC (permalink / raw)
hello,
i would like to have 'smart' indentation, à la some editors i use like
textpad. if i indent a line, then when i press enter at the end of
the line, i want point to go to the indented position on the following
line. i can't find the way to make this work. it looks like
'adaptive-fill-mode' should do this, but it does not. having to go
back and 'indent-region' is annoying.
thanks.
mp
--
Michael Powe Waterbury, CT USA
-------------------------------------------------------------------
"It stands to reason that self-righteous, inflexible, single-minded,
authoritarian true believers are politically organized. Open-minded,
flexible, complex, ambiguous, anti-authoritarian people would just as
soon be left to mind their own fucking business." - R.U. Sirius
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-09 23:06 'smart' indentation Michael Powe
@ 2003-03-10 0:26 ` Johan Bockgård
2003-03-10 0:26 ` Benjamin Rutt
2003-03-10 14:01 ` Kai Großjohann
2 siblings, 0 replies; 11+ messages in thread
From: Johan Bockgård @ 2003-03-10 0:26 UTC (permalink / raw)
Michael Powe <michael@trollope.org> writes:
> hello,
>
> i would like to have 'smart' indentation, à la some editors i use like
> textpad. if i indent a line, then when i press enter at the end of
> the line, i want point to go to the indented position on the following
> line. i can't find the way to make this work. it looks like
> 'adaptive-fill-mode' should do this, but it does not. having to go
> back and 'indent-region' is annoying.
There is a function `newline-and-indent'. You want to bind this to
RET, I think (and you would probably find it is on C-j already).
/Johan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-09 23:06 'smart' indentation Michael Powe
2003-03-10 0:26 ` Johan Bockgård
@ 2003-03-10 0:26 ` Benjamin Rutt
2003-03-10 14:01 ` Kai Großjohann
2 siblings, 0 replies; 11+ messages in thread
From: Benjamin Rutt @ 2003-03-10 0:26 UTC (permalink / raw)
Michael Powe <michael@trollope.org> writes:
> hello,
>
> i would like to have 'smart' indentation, à la some editors i use like
> textpad. if i indent a line, then when i press enter at the end of
> the line, i want point to go to the indented position on the following
> line. i can't find the way to make this work. it looks like
> 'adaptive-fill-mode' should do this, but it does not. having to go
> back and 'indent-region' is annoying.
I think you want
(global-set-key (kbd "RET") 'newline-and-indent)
--
Benjamin
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-09 23:06 'smart' indentation Michael Powe
2003-03-10 0:26 ` Johan Bockgård
2003-03-10 0:26 ` Benjamin Rutt
@ 2003-03-10 14:01 ` Kai Großjohann
2003-03-10 17:03 ` Oliver Scholz
2003-03-10 20:33 ` Stefan Monnier
2 siblings, 2 replies; 11+ messages in thread
From: Kai Großjohann @ 2003-03-10 14:01 UTC (permalink / raw)
Michael Powe <michael@trollope.org> writes:
> i would like to have 'smart' indentation, à la some editors i use like
> textpad.
Compared with Emacs standards, that indentation is rather dumb...
> if i indent a line, then when i press enter at the end of the line,
> i want point to go to the indented position on the following line.
On the new line, invoke M-x indent-relative RET. I like to use that
in text mode a lot, so I do (define-key text-mode-map (kbd "RET")
'indent-relative) in my ~/.emacs file.
Usually, Emacs does syntax-driven indentation. This means that it
groks the syntax of your programming language and then uses the right
indentation level.
--
A preposition is not a good thing to end a sentence with.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-10 14:01 ` Kai Großjohann
@ 2003-03-10 17:03 ` Oliver Scholz
2003-03-10 18:22 ` Kai Großjohann
2003-03-10 20:02 ` Ole Laursen
2003-03-10 20:33 ` Stefan Monnier
1 sibling, 2 replies; 11+ messages in thread
From: Oliver Scholz @ 2003-03-10 17:03 UTC (permalink / raw)
kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:
[...]
> Usually, Emacs does syntax-driven indentation. This means that it
> groks the syntax of your programming language and then uses the right
> indentation level.
[...]
Does that imply that other editors don't have syntax driven
indentation???
Oliver
--
20 Ventôse an 211 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-10 17:03 ` Oliver Scholz
@ 2003-03-10 18:22 ` Kai Großjohann
2003-03-10 20:02 ` Ole Laursen
1 sibling, 0 replies; 11+ messages in thread
From: Kai Großjohann @ 2003-03-10 18:22 UTC (permalink / raw)
Oliver Scholz <alkibiades@gmx.de> writes:
> kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:
> [...]
>> Usually, Emacs does syntax-driven indentation. This means that it
>> groks the syntax of your programming language and then uses the right
>> indentation level.
> [...]
>
> Does that imply that other editors don't have syntax driven
> indentation???
No.
All I was saying is that the OP's idea of 'smart indentation'
corresponds to Emacs' idea of 'dumb indentation'.
--
A preposition is not a good thing to end a sentence with.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-10 17:03 ` Oliver Scholz
2003-03-10 18:22 ` Kai Großjohann
@ 2003-03-10 20:02 ` Ole Laursen
2003-03-10 20:24 ` Oliver Scholz
1 sibling, 1 reply; 11+ messages in thread
From: Ole Laursen @ 2003-03-10 20:02 UTC (permalink / raw)
Oliver Scholz <alkibiades@gmx.de> writes:
> kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:
> [...]
> > Usually, Emacs does syntax-driven indentation. This means that it
> > groks the syntax of your programming language and then uses the right
> > indentation level.
> [...]
>
> Does that imply that other editors don't have syntax driven
> indentation???
I think most haven't, at least not for more than one or two languages.
It's not trivial to implement. I think most fake it like
indent-relative.
--
Ole Laursen
http://www.cs.auc.dk/~olau/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-10 20:02 ` Ole Laursen
@ 2003-03-10 20:24 ` Oliver Scholz
0 siblings, 0 replies; 11+ messages in thread
From: Oliver Scholz @ 2003-03-10 20:24 UTC (permalink / raw)
Ole Laursen <olau@hardworking.dk> writes:
> Oliver Scholz <alkibiades@gmx.de> writes:
[...]
>> Does that imply that other editors don't have syntax driven
>> indentation???
>
> I think most haven't, at least not for more than one or two languages.
> It's not trivial to implement. I think most fake it like
> indent-relative.
[...]
*shudder* It's a cold and cruel world out there, outside of Emacs.
Oliver
--
20 Ventôse an 211 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-10 14:01 ` Kai Großjohann
2003-03-10 17:03 ` Oliver Scholz
@ 2003-03-10 20:33 ` Stefan Monnier
2003-03-11 11:50 ` Kai Großjohann
1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2003-03-10 20:33 UTC (permalink / raw)
>>>>> "Kai" == Kai Großjohann <kai.grossjohann@uni-duisburg.de> writes:
> in text mode a lot, so I do (define-key text-mode-map (kbd "RET")
> 'indent-relative) in my ~/.emacs file.
Really ? What do you then use to break a line ?
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-10 20:33 ` Stefan Monnier
@ 2003-03-11 11:50 ` Kai Großjohann
2003-03-11 15:11 ` Stefan Monnier
0 siblings, 1 reply; 11+ messages in thread
From: Kai Großjohann @ 2003-03-11 11:50 UTC (permalink / raw)
"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:
>>>>>> "Kai" == Kai Großjohann <kai.grossjohann@uni-duisburg.de> writes:
>> in text mode a lot, so I do (define-key text-mode-map (kbd "RET")
>> 'indent-relative) in my ~/.emacs file.
>
> Really ? What do you then use to break a line ?
I meant TAB, not RET. Sorry.
--
A preposition is not a good thing to end a sentence with.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: 'smart' indentation
2003-03-11 11:50 ` Kai Großjohann
@ 2003-03-11 15:11 ` Stefan Monnier
0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2003-03-11 15:11 UTC (permalink / raw)
>>> in text mode a lot, so I do (define-key text-mode-map (kbd "RET")
>>> 'indent-relative) in my ~/.emacs file.
>> Really ? What do you then use to break a line ?
> I meant TAB, not RET. Sorry.
Huh? But then why bother ? It's already the default behavior !
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2003-03-11 15:11 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-09 23:06 'smart' indentation Michael Powe
2003-03-10 0:26 ` Johan Bockgård
2003-03-10 0:26 ` Benjamin Rutt
2003-03-10 14:01 ` Kai Großjohann
2003-03-10 17:03 ` Oliver Scholz
2003-03-10 18:22 ` Kai Großjohann
2003-03-10 20:02 ` Ole Laursen
2003-03-10 20:24 ` Oliver Scholz
2003-03-10 20:33 ` Stefan Monnier
2003-03-11 11:50 ` Kai Großjohann
2003-03-11 15:11 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.