From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Comment/Uncomment in C files? Date: Sun, 20 Apr 2008 11:40:08 +0000 Message-ID: <20080420114008.GA1133@muc.de> References: <4809b5de$0$90267$14726298@news.sunsite.dk> <4809cde8$0$90266$14726298@news.sunsite.dk> <4809d0ee$0$90270$14726298@news.sunsite.dk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1208690574 8840 80.91.229.12 (20 Apr 2008 11:22:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Apr 2008 11:22:54 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: saneman Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 20 13:23:28 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JnXdo-0006DS-5h for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Apr 2008 13:23:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JnXd8-0002X0-Rx for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Apr 2008 07:22:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JnXcp-0002U2-QA for help-gnu-emacs@gnu.org; Sun, 20 Apr 2008 07:22:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JnXco-0002Qj-6W for help-gnu-emacs@gnu.org; Sun, 20 Apr 2008 07:22:26 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JnXco-0002QU-4M for help-gnu-emacs@gnu.org; Sun, 20 Apr 2008 07:22:26 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JnXcn-0000Gw-MX for help-gnu-emacs@gnu.org; Sun, 20 Apr 2008 07:22:26 -0400 Original-Received: (qmail 45713 invoked by uid 3782); 20 Apr 2008 11:22:20 -0000 Original-Received: from acm.muc.de (p57AF5EB9.dip.t-dialin.net [87.175.94.185]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sun, 20 Apr 2008 13:22:18 +0200 Original-Received: (qmail 1510 invoked by uid 1000); 20 Apr 2008 11:40:09 -0000 Content-Disposition: inline In-Reply-To: <4809d0ee$0$90270$14726298@news.sunsite.dk> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 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 Xref: news.gmane.org gmane.emacs.help:53412 Archived-At: Hi, Saneman! On Sat, Apr 19, 2008 at 01:02:07PM +0200, saneman wrote: > saneman wrote: > >>(define-key c-mode-base-map "\C-d" nil) > >Above gives an error: > >An error has occurred while loading `/home/mm/.emacs': > >Symbol's value as variable is void: c-mode-base-map Whoops, sorry! What happened there was that CC Mode hadn't been loaded when you tried to execute the `define-key'. > This did the trick: > (define-key c-mode-base-map "\C-d" 'comment-dwim) That will suffer exactly the same problem. What you need is (defun sm-C-d () (define-key c-mode-base-map "\C-d" 'comment-dwim)) ; or nil (add-hook 'c-initialization-hook 'sm-C-d) , fairly early on in your .emacs. That will cause the key to rebound when CC Mode later gets loaded. -- Alan Mackenzie (Nuremberg, Germany).