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

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

Key binding problem


From: address@hidden
Subject: Key binding problem
Date: 26 Feb 2007 05:23:29 -0800
User-agent: G2/1.0

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



reply via email to

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