gpt4 book ai didi

Emacs 口齿不清 : how to append to the list "LaTeX-clean-intermediate-suffixes"?

转载 作者:行者123 更新时间:2023-12-01 09:35:14 26 4
gpt4 key购买 nike

我想将一些正则表达式附加到 latex 命令 LaTeX-clean-intermediate-suffixes。我试过了

(setq LaTeX-clean-intermediate-suffixes
(append LaTeX-clean-intermediate-suffixes (list "\\.foo" "\\.bar")))

但我收到以下警告:

Warning (initialization): An error occurred while loading `/Users/myusername/.emacs':

Symbol's value as variable is void: LaTeX-clean-intermediate-suffixes

To ensure normal operation, 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.

如何在此列表中添加一些字符串/后缀?

最佳答案

看起来您正试图在加载定义它的包之前修改变量的值。 C-h v 表明该变量是在“latex.el”文件中定义的,因此请尝试执行以下操作:

(eval-after-load 'latex
'(setq LaTeX-clean-intermediate-suffixes
(append LaTeX-clean-intermediate-suffixes (list "\\.foo" "\\.bar"))))

请注意,eval-after-load 是一个函数,并且需要引用您要评估的代码 - 有点令人困惑,因为它与名称相似的 eval-when 不同-compile 和 friend ,都是宏。

顺便说一句,您还可以使用 add-to-list 将项目添加到列表中,使用 t 的第三个参数使其附加而不是将它们添加到前方。 add-to-list 也是一个函数,所以这里需要引用变量名。有时这比 setqappend 的组合更具可读性,但您一次只能添加一项​​:

(add-to-list 'LaTeX-clean-intermediate-suffixes "\\.foo" t)

这样做的另一个优点是它会在添加之前检查 "\\.foo" 是否已经存在于列表中——这对于加载路径之类的东西很有用。

关于Emacs 口齿不清 : how to append to the list "LaTeX-clean-intermediate-suffixes"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9249977/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com