0

I don't like all the major mode bindings. So I usually just (setq the-map-in-question (make-sparse-keymap)) each time I come across a new major mode.

But for c++-mode-map, it does not remain empty. I use help-fns+.el to display the bindings of the keymap. When I open emacs, c++-mode-map is indeed empty. But as soon as I open a C++ file, the following bindings in the keymap (in the picture) appears.

Why? Picture of the keymaps that appears in c++-mode-map

Edit: This part seems to be the problem (in cc-mode.el): enter image description here

I still don't know how to fix this issue though.

1

1 Answer 1

4

Messing with keymaps is usually best done after the defining library has loaded.

(with-eval-after-load "cc-mode"
  (setq c++-mode-map (make-sparse-keymap)))
1
  • Works perfectly! Thanks!
    – Alan
    Commented Mar 17, 2022 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.