Emacs "void-variable custom-set-variables" 错误
Emacs "void-variable custom-set-variables" error
我是 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文件中修复?非常感谢!
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(自定义)不干涉您的 init 文件,而是将此类自动表达式放在您的 custom-file
中。
我是 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文件中修复?非常感谢!
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(自定义)不干涉您的 init 文件,而是将此类自动表达式放在您的 custom-file
中。