我是Emacs的新手,在尝试了一些模式之后,我得到了如下错误消息:
Warning (initialization): An error occurred while loading ‘/Users/Tao/.emacs’:
Symbol's value as variable is void: custom-set-variables然后,按照指令,我使用--debug-init选项启动了Emacs,下面是消息:
Debugger entered--Lisp error: (void-variable custom-set-variables)
eval-buffer(#<buffer *load*> nil "/Users/Tao/.emacs" nil t) ; Reading at buffer position 21
load-with-code-conversion("/Users/Tao/.emacs" "/Users/Tao/.emacs" t t)
load("~/.emacs" noerror nomessage)
startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1fee6b60d6f5>) #f(compiled-function () #<bytecode 0x1fee6b60d709>) t)
command-line()
normal-top-level()然后我打开了我的.emacs文件:
custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(custom-enabled-themes '(tango-dark))
'(package-selected-packages '(auctex proof-general)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(require 'package)
;; (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") ; see remark below
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(dolist (hook '(tex-mode-hook))
(add-hook hook (lambda () (flyspell-mode 1))))请问到底是什么错误,以及如何在init文件中修复它?首先要感谢大家!
发布于 2021-05-16 23:14:31
custom-set-variables是一个函数,而不是变量。您需要的表达式是car为custom-set-variables的列表
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(SOME-OPTION THE-OPTION-VALUE)
;; ...
)注意下面的注释。您似乎编辑了该表达式,并且删除了custom-set-variables之前的左括号。这无疑是一个意外(打字错误)。它强调了定义变量custom-file的建议,使Emacs (自定义)远离您的初始化文件,并将这些自动表达式放在您的custom-file中。
https://stackoverflow.com/questions/67555508
复制相似问题