Emacs:尝试切换到 latex 模式时出现与 dbus 相关的错误

标签 emacs dbus auctex

自从我几天前开始在 Emacs 中使用 dbus(这意味着我使用 dbus-support 重新编译),当我打开一个 latex 文件或尝试手动切换到 latex 模式时,我得到

File mode specification error: (invalid-function dbus-ignore-errors)

并且 emacs 在基本模式下停在那里。

我将 dbus 用于 Zeitgeist-Support,它运行良好,直到重新编译,Auctex 也同样运行良好。我检查了 dbus-functions 是否与结果一起可用:它们出现在帮助中(包括“dbus-ignore-errors”),但它们似乎不适用于 execute-extended-commad (M-x),这意味着它们没有'不显示在完成中并且不能被执行。另一方面,它们可用于 lisp-eval。

我不知道这是否是这些函数的正常行为,但无论如何,auctex 函数的可用性似乎存在某种问题?

禁用 zeitgeist-plugin 并不会改变这种情况。

有什么建议么?

最好的祝福

马蒂亚斯

最佳答案

错误 invalid-function通常意味着在定义某个宏之前编译了一段 Emacs Lisp 代码,现在正试图将该宏作为函数调用。为了解决这个问题,找到有问题的模块并在确保定义了宏(dbus-ignore-errors)后重新编译它。

对于 Auctex,发生这种情况是因为 tex.el包含以下内容:

;; Require dbus at compile time to prevent errors due to `dbus-ignore-errors'
;; not being defined.
(eval-when-compile (and (featurep 'dbusbind)
            (require 'dbus nil :no-error)))

也就是说,它会尝试加载 dbus 库,但会忽略失败。如果编译 Auctex 的 Emacs 不支持 dbus,dbus-ignore-errors因此在编译 tex.el 时会被编译成函数调用。 .没问题,因为 dbus-ignore-errors通话受 featurep 保护测试。

如果这个字节编译的文件随后被加载到一个支持 dbus 的 Emacs 实例中,我们会突然到达有问题的行,并尝试将宏作为函数调用,但失败并显示 invalid-function .这就是为什么在加载到支持 dbus 的 Emacs 之前需要重新编译文件的原因。

解决此问题的一种方法是包装 dbus-ignore-errors进入 eval ,改变这一行:
     (dbus-ignore-errors (dbus-get-unique-name :session))

对此:
     (eval '(dbus-ignore-errors (dbus-get-unique-name :session)))

这会将如何评估该表达式的决定推迟到运行时,Emacs 将知道 dbus-ignore-errors是一个宏。

关于Emacs:尝试切换到 latex 模式时出现与 dbus 相关的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29388541/

相关文章:

Emacs - slime - 将当前函数保存到文件

emacs - AUCTeX:自定义 ‘fill-nobreak-predicate’ 钩子(Hook)以尊重大括号

emacs - 使用 AUCTeX 在 Emacs 中引用\的建议

emacs - 如何在 elisp 中为交互式缓冲区设置名称

Emacs 指令 : Retain lines instead of dired-do-kill-lines?

linux - Linux 程序员如何在不使用 IDE 的情况下创建 GUI 应用程序?

c++ - 如何定义一个可以自省(introspection)的新 d-bus 接口(interface)?

c++ - 从 net.connman.Manager 的 GetService 方法动态提取 D-Bus 参数和对象路径

python - 在python中动态创建DBus信号

emacs - 使用(填充段落)防止 Auctex 缩进