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

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

Re: Emacs and C programming


From: Sven Joachim
Subject: Re: Emacs and C programming
Date: Fri, 07 Dec 2007 18:50:09 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

On 2007-12-07 18:20 +0100, address@hidden wrote:

> Hi,
> I add this line in my .emacs file:
>
> (define-key c-mode-base-map "\C-m' newline-and-indent)
>
> To make RET (newline, C-m) equivalent to LFD (newline and indent, C-j).
>
> But when start Emacs says: "Symbol's value as variable is void:
> c-mode-base-map".

Surely, because c-mode has not been loaded yet.

> How could I fix it?

Use a hook to set the keybinding, e.g.

(add-hook 'c-mode-common-hook
          (lambda ()
            (define-key c-mode-base-map "\C-m" 'newline-and-indent)))

does the trick for me.  See also the Emacs manual,
(Info "(emacs)Hooks").

Cheers,
       Sven


reply via email to

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