reddit / emacs

Unbinding keys in gud

stevethebayesian · 2022-05-06 17:57
The command `gud_step` on my system is bound to the keys `C-c C-s` and `C-x C-a C-s`. I don't find this command particularly useful and have tried to unbind it by adding the following to my .emacs file: ``` ;; Remove 'gud-step' from the global map. (global-unset-key "\C-x\C-a\C-s") (global-unset-key "\C-c\C-s") (add-hook 'gdb-mode-hook (lambda() (local-unset-key (kbd "C-x C-a C-s")))) (add-hook 'gdb-mode-hook (lambda() (local-unset-key (kbd "C-c C-s")))) ``` When I `eval-region` and restart my `gud-gdb` session I still get the default behavior. What am I doing wrong?
ReallyRussell · 2022-05-07 01:16
Have you confirmed that your lambda's are actually being called? While you are debugging this, it is probably easier to use functions than lambda's.
leungbk · 2022-05-07 01:40
Possibly relevant: `gud-gdb` is written to reassign the bindings each time it is called: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/gud.el?h=e2fcbd8dbd091bb72915297c92a801cbe66f13c9#n824