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

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

Re: cc-mode question


From: robert . thorpe
Subject: Re: cc-mode question
Date: 13 Sep 2006 09:47:48 -0700
User-agent: G2/1.0

jronald wrote:
> The command (c-toggle-auto-hungry-mode 1) doesn't take effect, as I wrote in
> the following context:
>
> (require 'cc-mode)
> (require 'cc-cmds)  ;;I still don't know if it is neccesary
> (c-toggle-auto-hungry-mode 1)

That should work, but what you're doing here is loading CC mode in
order to configure it. This isn't necessarily the best thing to do.
Normally Emacs by itself contains on a few modes at startup in order to
make startup time reasonable.  When you load a C file then Emacs loads
all of CC mode.

The best way to configure it is to tell CC mode to run a bit of code
when it loads.  This is a hook.  You can do this directly with Elisp,
alternatively customize knows how to do it.

Go to C customize group, pick "CC mode common hook", select "show",
select "INS" and type (c-toggle-auto-hungry-mode 1)

In elisp you can do (add-hook 'cc-mode-hook (lambda ()
(c-toggle-auto-hungry-mode 1))), which is equivalent.



reply via email to

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