[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comment/Uncomment in C files?
From: |
Alan Mackenzie |
Subject: |
Re: Comment/Uncomment in C files? |
Date: |
Sun, 20 Apr 2008 11:40:08 +0000 |
User-agent: |
Mutt/1.5.9i |
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).
Re: Comment/Uncomment in C files?, David Hansen, 2008/04/19