[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trying to bind a new key in C mode
From: |
Jim Hunter |
Subject: |
Re: Trying to bind a new key in C mode |
Date: |
12 Feb 2005 11:59:21 -0600 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
August <fusionfive@comhem.se> writes:
> On fre, 2005-02-11 at 18:09 -0600, Jim Hunter wrote:
> > I would like to bind C-c c to run the 'compile' function in C mode
> > (and, ultimately, C-c r to run 'recompile'), but cannot get it to
> > work. Unfortunately, I know nothing about Lisp, so I simply copied
> > the example from the Emacs info page "Local Keymaps" and modified it
> > to this (in my .emacs file):
> >
> > (add-hook 'c-mode-hook
> > '(lambda ()
> > (define-key c-mode-map "\C-cc" 'compile)))
> >
>
> Try
>
> (add-hook 'c-mode-hook
> '(lambda () (local-set-key "\C-cc" 'compile)))
>
[snip]
Thanks very much for the reply. When your example also didn't work,
I realized that cc-mode might be loading before that part of .emacs was
processed. Moving the add-hook call before my desktop was loaded fixed
it -- both for your example and the original example.
Thanks again!
Jim