[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: automatic indentation in C,C++ modes
From: |
Tony Harbin |
Subject: |
Re: automatic indentation in C,C++ modes |
Date: |
Fri, 19 Apr 2002 12:30:46 -0500 |
No go. I've inserted these commands into my .emacs file, but still, when I type
a "(", the line gets re-indented. Also, when I do a "C-h k (", the key is still
described as running c-electric-paren.
I had this behavior turned off in an older version on Solaris, but the methods
that I used there no longer work. The best solution would be to remap the
'(', '{', ':', and '/' keys to simple self-insert-command functions. I have a
particular indentation style that is common where I work and I *hate* some
software trying to enforce it's own style.
Any other suggestions? Thanks in advance.
Greg Hill wrote:
> Tony,
>
> It just takes more of the same, e.g.:
>
> (add-hook 'c-mode-hook
> (function (lambda ()
> (substitute-key-definition
> 'c-indent-command 'self-insert-command c-mode-map)
> (substitute-key-definition
> 'c-electric-paren 'self-insert-command c-mode-map))))
>
> M-x apropos
> c-electric
>
> will give you a list of all the c-electric- commands. Just use
> substitute-key-definition in your c-mode-hook and c++-mode-hook
> lambdas to replace any of them that you don't want with
> self-insert-command. If you want to keep the automatic indentation
> performed by the TAB key and ditch only the "electric" stuff, then
> just leave the substitution for c-indent-command out of your lambdas.
>
> --Greg
>
> At 11:51 AM -0500 4/15/02, Tony Harbin wrote:
> >Not quite. C/C++ mode binds open-paren, open-brace, colon, and slash (among
> >
> >others) to "electric" functions that, when the key is typed, automatically
> >change
> >the spacing and/or indentation on the line. I would like to
> >disable/override/turn off this behavior. I was able to do this in an older
> >version where I had to explicitly load the C/C++ mode modules, but in my
> >current version (20.7.1), the stuff was already compiled in and the same
> >tricks no longer work.
> >
> >Basically, I would just like those keys above to just self-insert and not
> >run the
> >"electric" functions. Is there a way to do this?
>
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
- automatic indentation in C,C++ modes, Tony Harbin, 2002/04/12
- Re: automatic indentation in C,C++ modes, Greg Hill, 2002/04/12
- Re: automatic indentation in C,C++ modes, Tony Harbin, 2002/04/15
- Re: automatic indentation in C,C++ modes, Greg Hill, 2002/04/15
- Re: automatic indentation in C,C++ modes,
Tony Harbin <=
- Emacs as web server, Greg Hill, 2002/04/22
- Re: automatic indentation in C,C++ modes, G Anna, 2002/04/23
- Re: automatic indentation in C,C++ modes, Tony Harbin, 2002/04/24