* Disabling Electric C Characters?
@ 2007-10-21 15:33 zenlikethat
2007-10-27 9:37 ` Alan Mackenzie
0 siblings, 1 reply; 2+ messages in thread
From: zenlikethat @ 2007-10-21 15:33 UTC (permalink / raw)
To: Help-gnu-emacs
Hey guys, I'm having some trouble disabling electric characters in C mode in
my version of Emacs on Ubuntu.
Every time I type in a curly brace to close off a block of code like a
function or an if statement, the "}" reindents, completely disregarding
wherever I may have put it. I don't like this and am trying my hardest to
turn it off, but nothing seems to work.
I've tried putting
(setq-default c-electric-flag nil) and
(setq-default c-syntactic-indentation nil)
in my .emacs file, but to no avail.
Any suggestions?
Thanks,
Nathan
--
View this message in context: http://www.nabble.com/Disabling-Electric-C-Characters--tf4666486.html#a13330196
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Disabling Electric C Characters?
2007-10-21 15:33 Disabling Electric C Characters? zenlikethat
@ 2007-10-27 9:37 ` Alan Mackenzie
0 siblings, 0 replies; 2+ messages in thread
From: Alan Mackenzie @ 2007-10-27 9:37 UTC (permalink / raw)
To: zenlikethat; +Cc: Help-gnu-emacs
Hi, Nathan.
On Sun, Oct 21, 2007 at 08:33:51AM -0700, zenlikethat wrote:
> Hey guys, I'm having some trouble disabling electric characters in C
> mode in my version of Emacs on Ubuntu.
OK, first things first - Have you got a recent enough version of CC
Mode? The rest of your post suggests you have, but just to make
sure.... Do M-x c-version. You need 5.31 or higher. This version of
CC Mode only became part of GNU Emacs at version emacs-22.1. If
necessary, you can download the current version (5.31.4) from
<http://cc-mode.sourceforge.net/release.php>.
> Every time I type in a curly brace to close off a block of code like a
> function or an if statement, the "}" reindents, completely
> disregarding wherever I may have put it. I don't like this and am
> trying my hardest to turn it off, but nothing seems to work.
OK. The thinking behind this feature is that the indentation of a line
can often be calculated only _after_ the line's been typed, not before.
So things like "}" and ";" trigger reindentation. I'd recommend you to
get to like this if you can. :-) However, let's accept that you can't
or won't.
Does C-c C-l (`c-toggle-electric-state') work?
> I've tried putting
> (setq-default c-electric-flag nil) and
> (setq-default c-syntactic-indentation nil)
> in my .emacs file, but to no avail.
> Any suggestions?
(setq-default c-electric-flag nil) should work. There may be a bug in
CC Mode here.
One other thing to try would be disabling the electricity in a hook.
Try this in your .emacs:
(defun zlt-disable-electricity ()
(c-toggle-electric-state -1))
(add-hook 'c-mode-common-hook 'zlt-disable-electricity)
> Thanks,
> Nathan
--
Alan Mackenzie (Ittersbach, Germany).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-27 9:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-21 15:33 Disabling Electric C Characters? zenlikethat
2007-10-27 9:37 ` Alan Mackenzie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).