[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Novice question: my add-hook binding for c-mode doesnt work :(
From: |
Alan Mackenzie |
Subject: |
Re: Novice question: my add-hook binding for c-mode doesnt work :( |
Date: |
Sat, 3 Dec 2005 21:15:38 +0000 |
User-agent: |
tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) |
"Kpoxman (sent by Nabble.com)" <lists@nabble.com> wrote on Fri, 2 Dec
2005 01:10:36 -0800 (PST):
> Thank you guys!
> So, the correct code is (I've tested and it works):
> (add-hook 'c-mode-common-hook
> '(lambda () (define-key c-mode-base-map (kbd "M-o")
> 'kpox-switch-h-cpp))
> )
Just one small point: The above code "adds" the binding to the key map
every time you open a CC Mode buffer. You really only need to add the
key binding once: use CC Mode's initialization hook instead:
(add-hook 'c-initialization-hook
'(lambda () (define-key c-mode-base-map (kbd "M-o")
'kpox-switch-h-cpp)))
--
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").