I've been experimenting with electric braces, and for now if I type :
"for(bla){"
electrically I get
"for(bla)
{
}
_ "<<point is here and indented correctly
What do I need to change to get instead
for(bla){
_ <<<< point is here and indented correctly
}
I've looked at changing c-hanging-braces-alist but the doc in my opinion is
not very clear...I've tried adding
(substatement-open after) and (defun-open after) and that part works.
What do I have to do to get it to move point *inside* the braces?
thx
M
> What do I need to change to get instead
> for(bla){
> _ <<<< point is here and indented correctly
> }
Since you didn't tell us what you were doing initially, how can we
know what you need to change?
I recommend using skeletons for this. You can easily define a
skeleton which inserts a for loop. And then you can define an abbrev
which runs the function that is the skeleton. Hint: type C-h f
define-abbrev RET for information on using that from Lisp. You need
to use it from Lisp to do what you want.
kai
--
The arms should be held in a natural and unaffected way and never
be conspicuous. -- Revised Technique of Latin American Dancing
I've got yhe following in my .emacs :
(c-toggle-auto-state 1)
(c-set-style "stroustrup")
which acticvates the electric braces (among other) features. In the case
that interests me, using electric braces means: typing an opening brace '{'
causes emacs to automatically enter a new line and indent. In the same way,
typing a closing brace '}' causes emacs to enter a newline. That behaviour,
of course, is duplicatable with skeletons or macros, but why not use
built-in features of the styles functions? That's why, I would like to know
if in addition to customizing the addition of newlines (begore, after) I can
also customize where the point will be (as decribed in my first post).
Hope it is clearer.
Thx
M
"M" <Montr...@hotREMOVmail.com> wrote in message
news:dARR5.4205$B6.3...@news20.bellglobal.com...
> Hi,
>
> I've been experimenting with electric braces, and for now if I type :
>
> "for(bla){"
> electrically I get
>
> "for(bla)
> {
> }
> _ "<<point is here and indented correctly
>
> What do I need to change to get instead
> for(bla){
> _ <<<< point is here and indented correctly
> }
>
Nicolas
thx
M
"Nicolas Rist" <Nicola...@alcatel.de> wrote in message
news:3A1A77B7...@alcatel.de...
Nicolas
But if you find out how to get the cc-mode style functions to do what
you want, please tell me...
I"ll keep looking...for a little while longer...and then I'll probably
revert to skeletons or macros....
M
"Kai Großjohann" <Kai.Gro...@CS.Uni-Dortmund.DE> wrote in message
news:vafn1es...@lucy.cs.uni-dortmund.de...