How to disable ctrl + c in emacs

I am a new user in emacs and am using emacs because of ansi-term / mult-term Now I need to type ctrl + C twice to send it to the term. I would like to unbind CTRL + C in emacs so that I can send it directly to the term. Is it possible?

+4
source share
2 answers

Solution for overriding all other layouts in terminal mode buffers:

(defun jpk/term-mode-hook ()
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "C-c") 'term-send-raw)
    (set-transient-map map (lambda () t))))

(add-to-hook 'term-mode-hook 'jpk/term-mode-hook)

Assuming you have no other bindings to C-c(this is unlikely, see below):

(define-key term-mode-map (kbd "C-c") 'term-send-raw)

This was enough to run emacs using emacs -q(i.e. without any configuration).


, , , . C-c Emacs, , . , , , . , Emacs 100% , .

+1

, , nil .

, C-c: (global-set-key "\C-c" nil).

foo: (define-key foo-mode-map "\C-c" nil).


, . , (current-local-map) (current-global-map). , M-x report-emacs-bug, C-c . , :

(define-key (current-local-map) "\C-c" nil)
(define-key mml-mode-map "\C-c" nil)

, mml-mode-map? C-c C-h.

+1

Source: https://habr.com/ru/post/1620992/


All Articles