Emacs: Symbol's value as variable is void
这是我的
1 2 3 | (setq-default c-basic-offset 4 c-default-style"linux") (setq-default tab-width 4 indent-tabs-mode t) (define-key c-mode-base-map (kbd"RET") 'newline-and-indent) |
打开emacs时收到警告:
Warning (initialization): An error occurred while loading
c:/home/.emacs :Symbol's value as variable is void:
c-mode-base-map To ensure normal operations, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with the
--debug-init option to view a complete error backtrace.
我运行了
Debugger entered--Lisp error: (void-variable
c-mode-base-map )
1
2
3
4
5
6
7
8 (define-key c-mode-base-map (kbd"RET") (quote newline-and-indent))
eval-buffer(#<buffer *load*> nil"c:/home/.emacs" nil t)
; Reading at buffer position 311
load-with-code-conversion("c:/home/.emacs""c:/home/.emacs" t t)
load("~/.emacs" t t)
这意味着在调用
通常的解决方法是找出在何处定义并需要该模块。 在这种情况下:
1 | (require 'cc-mode) |
但是,还有其他可能的修复方法,例如在模式挂钩中设置键绑定或使用