[Top][All Lists]

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

Re: automatic indentation in C,C++ modes

From: Greg Hill
Subject: Re: automatic indentation in C,C++ modes
Date: Mon, 15 Apr 2002 11:47:33 -0700


It just takes more of the same, e.g.:

(add-hook 'c-mode-hook
         (function (lambda ()
                 'c-indent-command 'self-insert-command c-mode-map)
                 'c-electric-paren 'self-insert-command c-mode-map))))

M-x apropos

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.


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
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?

reply via email to

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