首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Emacs "void-variable自定义设置变量“错误

Emacs "void-variable自定义设置变量“错误
EN

Stack Overflow用户
提问于 2021-05-16 18:25:19
回答 1查看 80关注 0票数 1

我是Emacs的新手,在尝试了一些模式之后,我得到了如下错误消息:

代码语言:javascript
复制
Warning (initialization): An error occurred while loading ‘/Users/Tao/.emacs’:

Symbol's value as variable is void: custom-set-variables

然后,按照指令,我使用--debug-init选项启动了Emacs,下面是消息:

代码语言:javascript
复制
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文件:

代码语言:javascript
复制
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文件中修复它?首先要感谢大家!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-16 23:14:31

custom-set-variables是一个函数,而不是变量。您需要的表达式是carcustom-set-variables的列表

代码语言:javascript
复制
(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中。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67555508

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档