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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Key binding problem


From: weber
Subject: Re: Key binding problem
Date: 26 Feb 2007 05:33:51 -0800
User-agent: G2/1.0

On 26 fev, 10:23, "address@hidden"
<address@hidden> wrote:
> Hi all,
>
> I'm trying to bind a few keys in c mode and so far, didn't have much
> success with it. I have the following defined in my .emacs:
>
> (defun my-c-mode-common-hook ()
>   (local-set-key [C-|] 'indent-region)
>   (local-set-key [C-%] 'query-replace-regexp)
>   (local-set-key (kbd "RET") 'newline-and-indent)
>   (local-set-key [C-/] 'comment-region)
>   (local-set-key [C-?] 'uncomment-region)
>   (c-subword-mode 1)
>   )
>
> (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
>
> The only binding that works is the one for the newline-and-indent
> command. For the other ones, emacs tells me that the key combination
> is not defined. However, if I run local-set-key interactively once
> emacs is done loading and after visiting a C++ file, it works. I tried
> the same bindings in c++-mode-hook but, unsurprisingly, it made no
> difference at all which.
>
> What am I doing wrong?
>
> Thanks in advance
> Jean

I don't know about this local-set-key command...

Could you try changing to something like these
  (define-key c-mode-map "\C-%" 'query-replace-regexp)
instead?

Cheers,
weber



reply via email to

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