【问题标题】:Symbol's value as variable is void: debian-emacs-flavor when running ispell on tex fileSymbol 作为变量的值是 void: debian-emacs-flavor 在 tex 文件上运行 ispell 时
【发布时间】:2020-05-09 07:33:28
【问题描述】:

当我尝试运行 ispell 时,我不断收到此错误。我不确定问题出在哪里,但我最近(在 Ubuntu 10.04 上)从 23.1 更新到最新的 emacs 23.3。我刚刚将 emacs-goodies-el 从 debian 包维护者复制到了我放在主文件夹中的 site-lisp。如果我从旧版本中未编辑的文件开始或创建新文件,它似乎运行得很好。如果我打开我之前正在编辑的 tex 文件,则会将其关闭。然后我尝试打开的任何文件在下面都有相同的错误。在我的另一台具有类似设置的计算机上,我用相同的 .emacs 做了同样的事情,它没有问题。我可以很好地打开这些相同的 tex 文件。是否在某个地方存储了一些这样的信息或关于在哪里查找的建议。如果我打开一个新文件,它会显示:

Enabling Flyspell mode gave an error

然后运行 ​​M-x ispell 给出:

not: Symbol's value as variable is void: debian-emacs-flavor

这是错误。奇怪的是,现在 flyspell/ispell 在我之前遇到问题的文件中运行良好,但如果我创建新文件,它似乎不起作用。如果我在 tex 模式下制作新文件,我似乎没有问题。另外我应该注意,当我使用latex/tex 时,我通常运行emacs -q --load ~\.emacstex。我有一种感觉,也许这个变量是在 default.el 中设置的(不确定)??这是错误:

Debugger entered--Lisp error: (void-variable debian-emacs-flavor)
  (member debian-emacs-flavor (quote (emacs20 emacs21)))
  (not (member debian-emacs-flavor (quote ...)))
  (if (not (member debian-emacs-flavor ...)) (delete-process ispell-process) (process-send-eof ispell-process) (if (eq ... ...) (ispell-accept-output 1)) (if (eq ... ...) (kill-process ispell-process)) (while (not ...) (if ... ... ...)))
  ispell-delete-ispell-process()
  (if ispell-async-processp (ispell-delete-ispell-process) (ispell-send-string "\n") (kill-buffer ispell-output-buffer) (kill-buffer ispell-session-buffer) (setq ispell-output-buffer nil ispell-session-buffer nil))
  (if (not (and ispell-process ...)) (or no-error (error "There is no ispell process running!")) (if ispell-async-processp (ispell-delete-ispell-process) (ispell-send-string "\n") (kill-buffer ispell-output-buffer) (kill-buffer ispell-session-buffer) (setq ispell-output-buffer nil ispell-session-buffer nil)) (setq ispell-process nil) (message "Ispell process killed") nil)
  ispell-kill-ispell(t)
  (if (and ispell-buffer-local-name (not ...)) (ispell-kill-ispell t))
  ispell-buffer-local-words()
  ispell-accept-buffer-local-defs()
  (if (not recheckp) (ispell-accept-buffer-local-defs))
  ispell-region(1 24)
  ispell-buffer()
  (if (and (boundp ...) transient-mark-mode (boundp ...) mark-active) (ispell-region (region-beginning) (region-end)) (ispell-buffer))
  ispell()
  call-interactively(ispell t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

【问题讨论】:

  • 执行M-x toggle-debug-on-error,然后再次执行M-x ispell。 Emacs 会给你一个*Backtrace* 错误缓冲区。粘贴 *Backtrace* 缓冲区的内容,以便我们这些没有得到您确切错误的人可以帮助您。
  • 您究竟是如何升级到 23.3 的? Ubuntu 10.04 仍然是正式的 23.1。您是否创建了自己的构建?还是从 PPA 安装?
  • @tripleee-是的,我在我的主目录中创建了自己的构建。然后只需复制 emacs-goodies-el 文件即可。在我的其他自定义文件中添加到 site-lisp 文件夹。在我的 .emacstex 文件中使用 Tyler 答案似乎可以使一切正常。我一直想为所有模式创建一个 .emacs 文件。我最初设置它时有不同的,因为当我运行 emacs 时,我只希望它记住 windows,而当我使用乳胶模式时不记得什么。重新打开窗户很好。所有其他时间通常在打开文件时。我不想加载所有这些 tex 窗口。
  • @J Spen - 为一个版本的 Emacs 打包的扩展与另一个版本混合可能会给您带来更多问题。将打包的 Emacs 与您自己安装的扩展一起使用通常没问题。但是 emacs-goodies 假定您已经安装了“Debian 化”版本的 Emacs,而您不再是这种情况!
  • 您可以安装适当的 Debianized 版本,试试 naquadah PPA emacs.naquadah.org(尽管它们可能已经在 emacs24 上)

标签: ubuntu emacs debian latex


【解决方案1】:

debian-emacs-flavor 显然是由Debian package maintainers 设置的变量它不会存在于其他 Emacs 发行版中,但我会根据您的错误假设 emacs-goodies.el 中的某些内容需要它。两种解决方案:丑陋的 hack 是将以下内容添加到您的 .emacs 中以提供变量。

 (defconst debian-emacs-flavor 'emacs23
   "A symbol representing the particular debian flavor of emacs running.
 Something like 'emacs20, 'xemacs20, etc.")

这可能会解决眼前的问题,同时冒着给 emacs-goodies.el 包的其他部分引入新问题的风险。

更好的解决方案是不要混合使用 Ubuntu 和 Debian 软件包,只需从 Ubuntu 存储库或上游源安装您需要的软件包。更多的工作,但不太可能在未来引起类似的冲突。

【讨论】:

  • 这些都来自 ubuntu repos。然后,当我安装 23.3 时,我只是从 23.1 安装中复制了它们。这是很好的信息。如果我再次开始收到错误,我会调查。
  • 我不明白你当时做了什么。如果 emacs-goodies 在存储库中,为什么不直接安装官方版本?为什么要手动复制?听起来您混合了打包和未打包(即上游)程序。
【解决方案2】:

debian-emacs-flavor 变量缺少定义几乎肯定是由于您在启动时使用了emacs -q 造成的。避免加载不必要的垃圾的惯用方法是在您的 .emacs 中设置条件,也许像这样;

(eval-after-load 'tex-mode '(load-file (expand-file-name "~/.emacstex")))

那样,只有当您实际以 TeX 模式(或派生模式……我认为)打开文件时,才会加载这些自定义设置。当您确实想编辑 TeX 文件时,您必须做一些补充以避免从您的 .emacs 加载不必要的东西。 (无论如何都不建议退出并重新启动 Emacs,因为您会丢失 kill ring 历史等)

有关 Flyspell 如何与 Ubuntu 的 Emacs 集成的更多背景信息,另请参阅 https://bugs.launchpad.net/ubuntu/+source/dictionaries-common/+bug/619015

编辑:在仔细阅读您的问题后进行重大重构。

【讨论】:

  • @tripleee-我重做了,所以现在我只运行 emacs --load .emacstex 但如果我没有在 .emacstex 中定义 debian-emacs-flavor,我仍然会遇到问题。如果我这样做,那么一切似乎都很好。我猜有些东西与 auctex 或 reftex 包冲突。我在 .emacsfile 中看不到任何会导致它失控的东西。这是上面的一个有趣的线程。我可能会尝试获取上游文件,看看是否能解决问题。至少我有一个临时的解决方案。
  • @tripleee-似乎只有在我运行 auctex 或 tex 文件所在的文件夹中创建文件时才会发生。尚未完全验证,但似乎确实如此。
猜你喜欢
  • 2023-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多