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

[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: Sat, 19 Apr 2008 10:25:46 +0000
User-agent: Mutt/1.5.9i

On Sat, Apr 19, 2008 at 11:06:38AM +0200, saneman wrote:
> I use emacs22 and have enabled CUA mode. I have assigned 
> Comment/Uncomment to:


> ;; Toogle comment/uncomment
> (global-set-key "\C-d" 'comment-dwim)

Quick question: why do you want to do this?  comment-dwim has M-; as a
standard key binding, which is surely just as easy to type, and just as
(un)intuitive ;-).

However, if you just want to do this for no particular reason, .....

> But nothing happens when I press C-d. Does emacs C-mode use some other 
> config files?

C Mode itself binds C-d to c-electric-delete-forward.  More to the point,
it binds it in the keymap c-mode-base-map, and this keymap takes
precedence over the global keymap.  So, if you want your global key
binding to be seen, you'll have to suppress the local keybinding.
Something like this (untested) should work:

(define-key c-mode-base-map "\C-d" nil)

That is, if you _really_ want to do it.

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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