Emacs: Symbol’s value as variable is void

What this means is that, at the point at which you invoke define-key, c-mode-base-map is not yet defined by anything.

The usual fix is to find out where this is defined and require that module. In this case:

(require 'cc-mode)

However there are other possible fixes as well, for example setting the key-binding in a mode hook, or using eval-after-load. Which one you use is up to you; I tend to do the KISS approach since I don’t generally care about startup time; but if you do you may want something lazier.

Leave a Comment

tech