How to change GUD breakpoint keybinding to the old one

前提是你 提交于 2020-01-04 02:29:08

问题


Currently, I am using GUD in the newest version of Emacs. The keybinding has changed since the old Emacs. Now it is "\C-x \C-a \C-b" for setting a breakpoint but it was \C-[space].

I was wondering if there is anyway to change the keybinding to the old format? (For some reason I cannot change my Emacs version)

I am using Emacs 24.5

Here is my .emacs file:

;; .emacs

;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)

;; turn on font-lock mode
(when (fboundp 'global-font-lock-mode)
  (global-font-lock-mode t))

;; enable visual feedback on selections
;(setq transient-mark-mode t)

;; default to better frame titles
(setq frame-title-format
      (concat  "%b - emacs@" (system-name)))

;; default to unified diffs
(setq diff-switches "-u")

;; always end a file with a newline
;(setq require-final-newline 'query)

;; Show main source buffer when using gdb
(setq gdb-show-main t)

;; Show all debugging frames in GDB
(setq gdb-many-windows t)

;; see buffer list on the same frame
(global-set-key "\C-x\C-b" 'buffer-menu)

;; old keybinding for breakoint in GUD
(require 'gud)
(define-key gud-mode-map "\C-x SPC" 'gud-break)

回答1:


Changing your Emacs version should not be necessary. Try this:

(require 'gud)
(define-key gud-mode-map (kbd "C-SPC") 'gud-break)

This will allow you to trigger gud-break with C-SPC. If you are not talking about the gud-break command, replace it with the command you are referring too.

Generally, the answer to the question "can I change this keybinding?" is always "yes" in Emacs.




回答2:


Somehow I was able to fix it with this:

(require 'gud)
(global-set-key [24 32] (quote gud-break))


来源:https://stackoverflow.com/questions/39394456/how-to-change-gud-breakpoint-keybinding-to-the-old-one

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!