From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jim Hunter Newsgroups: gmane.emacs.help Subject: Re: Trying to bind a new key in C mode Date: 12 Feb 2005 11:59:21 -0600 Message-ID: <87ll9tslqe.fsf@paradigmshift.homelinux.net> References: <87is4y3agp.fsf@paradigmshift.homelinux.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1108231189 10036 80.91.229.2 (12 Feb 2005 17:59:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 12 Feb 2005 17:59:49 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 12 18:59:49 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D01YW-000581-V5 for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Feb 2005 18:59:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D01ni-0001zn-0S for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Feb 2005 13:15:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!HSNX.atgi.net!cyclone-sf.pbi.net!216.218.192.242!news.he.net!newsfeed1.easynews.com!easynews.com!easynews!hwmnpeer01.phx!hwmedia!hw-poster!fe06.lga.POSTED!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 29 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-X-Trace: dkoicekneficefklnpmafngmaemladhlpifpcjojolkiedobbaebglacgccibhffhkimpnlhogeapfnppnhaeohlfgcchfjlopkjflkikmknngnadgifdaomekipffkiegcmjhhibopfakdb Original-NNTP-Posting-Date: Sat, 12 Feb 2005 11:06:43 MST Original-Xref: shelby.stanford.edu gnu.emacs.help:128523 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: main.gmane.org gmane.emacs.help:24055 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24055 August 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