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

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

Re: using auctex key bindings in C/C++ mode


From: Óscar Fuentes
Subject: Re: using auctex key bindings in C/C++ mode
Date: Sun, 26 Feb 2017 18:47:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Sivaram Neelakantan <address@hidden> writes:

> I'd like to use C-c C-c for compilation and C; for commenting out code
> in C/C++.  These are the default in Auctex mode.  Question is, is
> there anything I'd break if use the same in C/C++ mode when writing C
> code?

I don't think so.

> And is there a canonical way to unbind and rebind the defaults in
> C/C++ mode?

See help for functions `local-set-key', `local-unset-key' and variable
`c-mode-common-hook'.

For instance (untested):

(defun my-c-mode-common-hook ()
  (local-set-key (kbd "C-c C-c") 'compile)
  (local-set-key (kbd "C-;") 'comment-region))

(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)


For learning more, read about "Hooks" and "Key Bindinds" on the Emacs
manual.




reply via email to

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