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

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

Re: Setting auto-indentation of braces


From: tyler
Subject: Re: Setting auto-indentation of braces
Date: Wed, 18 Feb 2009 08:57:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Juha Nieminen <address@hidden> writes:

> Juha Nieminen kirjoitti:
>>   In the macosx version this autoindentation is off, and I can't
>> figure out where to turn it on. I'm so accustomed to it, that it's
>> annoying that it doesn't work...
>
>
> (defun insert-string(s)
>  (if (re-search-forward "" nil t)
>      (replace-match s)))
> (defun insert-open-curly() (interactive) (insert-string "{"))
> (global-set-key "\M-7" 'insert-open-curly)
>
>  Yes, as said, this is a really horrible hack, but with my limited
> knowledge of emacs it was the only thing I could come up with.
> I couldn't find any other way of "remapping" eg. "\M-7" to the curly
> brace. No wonder emacs is not auto-indenting the brace because
> I'm completely bypassing the logic behind it.

You have remapped M-7 to (insert-string "{"). If you open a file in
c-mode, and then enter C-h k { (no spaces), you'll see that the '{' key
is actually bound to c-electric-brace, not self-insert. So that's what
you should be targeting with your remapping.

Tyler 

-- 
I'm Tyler Smith and I approve of this email.





reply via email to

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