Emacs lua 模式问题:(交互调用的 void 函数 -p)

发布于 2024-11-26 17:40:30 字数 691 浏览 0 评论 0原文

我正在尝试为 emacs 21.4.1 安装 lua-mode (版本 20110428),但遇到问题。在我的 .emacs 文件中,我得到了:

(add-to-list 'load-path "~/.emacs.d/lua-mode/")
...
(setq auto-mode-alist (cons '("\\.lua$" . lua-mode) auto-mode-alist))
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)

我使用了这里的安装说明: http://lua-mode。 luaforge.net/ 另外,在我的 .emacs.d/ 目录中,我有 lua-mode/,其中包含 lua-mode.el。所有这些文件都具有正确的权限。

除了现在,当我使用 emacs 打开新文件“test.lua”时,我在暂存缓冲区中收到以下消息:

“文件模式规范错误:(void-function called-interactively-p)”

我正在运行 RHEL5。我在网上查看过但没有找到太多帮助。有人有什么建议吗?我不懂任何 LISP(所以很难调试 lua-mode.el),除了一些快捷方式之外,我对 emacs 也了解不多。

谢谢。

I'm trying to install lua-mode (version 20110428) for emacs 21.4.1 and am having problems. In my .emacs file I've got:

(add-to-list 'load-path "~/.emacs.d/lua-mode/")
...
(setq auto-mode-alist (cons '("\\.lua$" . lua-mode) auto-mode-alist))
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)

I used the installation instructions from here: http://lua-mode.luaforge.net/ Also, in my .emacs.d/ dir I have lua-mode/ which contains lua-mode.el. All of those files have the correct permissions.

Except now when I use emacs to open the new file "test.lua" I get the following message in the scratch buffer:

"File mode specification error: (void-function called-interactively-p)"

I'm running RHEL5. I've looked online but haven't found much help. Does anyone have any suggestions? I don't know any LISP (so it's hard to debug lua-mode.el) and apart from a handful of shortcuts, I don't know that much about emacs.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

楠木可依 2024-12-03 17:40:30

您使用的 Emacs 版本不具有带 1 个参数的“used-interactively-p”函数版本(该函数的早期版本不带参数)。您可以通过放置此解决方法来解决此问题(发布在这里:http://paste.lisp.org/ display/115598/raw) 在您的 Emacs 初始化文件中:

(condition-case nil (called-interactively-p 'interactive)
  (error
   ; Save reference to called-interactively-p in
   ; inglorion-system-called-interactively-p
   (fset 'inglorion-system-called-interactively-p
         (symbol-function 'called-interactively-p))
   ; Define called-interactively-p so that it discards
   ; its arguments and calls inglorion-system-called-interactively-p
   (fset 'called-interactively-p
         (lambda (&rest args)
           (inglorion-system-called-interactively-p)))))

但是,当我这样做并尝试使用 Emacs 22 进行测试时,由于某些功能不存在,我还遇到了其他错误,因此您可能必须如果您想使用 lua 模式,请升级您的 Emacs 版本。

使用 Emacs 23 和24、“lua-mode.el”似乎可以与现有的 lua 文件一起工作(我不是 lua 程序员,所以我无法正确测试它),但当您尝试创建新的 lua 文件时会中断。这实际上是“lua-mode.el”代码中的一个错误,当您尝试打开新的 lua 文件时会发生该错误(如果您尝试打开现有的 lua 文件则不会发生)。问题在于第 1218 行(在“lua-unmark-multiline-literals”函数中)的“remove-text-properties”调用正在调用起始值为“1”的“remove-text-properties”函数和结束值“0”(它是“0”,因为新文件的缓冲区大小为“0”。您可以通过将第 1218 行从:

    (remove-text-properties (or begin 1) (or end (buffer-size)) '(syntax-table ()))

更改为:

    (remove-text-properties (or begin 1)
                            (or end
                                (if (> (buffer-size) 0)
                                    (buffer-size)
                                  (or begin 1)))
                            '(syntax-table ()))

您应该让开发人员 来解决此问题“lua-mode.el”了解该错误,并且可能还请求对早期 Emacs 版本的支持。

You are using a version of Emacs that doesn't have the version of the "called-interactively-p" function that takes 1 argument (earlier versions of the function didn't take an argument). You can get around this by putting this workaround (posted here: http://paste.lisp.org/display/115598/raw) in your Emacs init file:

(condition-case nil (called-interactively-p 'interactive)
  (error
   ; Save reference to called-interactively-p in
   ; inglorion-system-called-interactively-p
   (fset 'inglorion-system-called-interactively-p
         (symbol-function 'called-interactively-p))
   ; Define called-interactively-p so that it discards
   ; its arguments and calls inglorion-system-called-interactively-p
   (fset 'called-interactively-p
         (lambda (&rest args)
           (inglorion-system-called-interactively-p)))))

However, when I did this and attempted to test with Emacs 22, I encountered other errors as well due to certain functions not being present so you may have to upgrade your version of Emacs if you want to use lua-mode.

With Emacs 23 & 24, "lua-mode.el" seems to work (I'm not a lua programmer so I couldn't test it properly) with existing lua files but breaks when you attempt to create a new lua file. It's actually a bug in the "lua-mode.el" code that occurs when you try to open a new lua file (it doesn't occur if you attempt to open an existing lua file). The problem is that the "remove-text-properties" call at line# 1218 (in the "lua-unmark-multiline-literals" function) is calling the "remove-text-properties" function with a begin value of "1" and an end value of "0" (it's "0" because the buffer-size is "0" for a new file. You can fix this by changing line# 1218 from:

    (remove-text-properties (or begin 1) (or end (buffer-size)) '(syntax-table ()))

to:

    (remove-text-properties (or begin 1)
                            (or end
                                (if (> (buffer-size) 0)
                                    (buffer-size)
                                  (or begin 1)))
                            '(syntax-table ()))

You should let the developer of "lua-mode.el" know about the bug and possibly also request support for earlier Emacs versions.

莫相离 2024-12-03 17:40:30

我恰好是 lua-mode 的维护者。我很幸运在网上冲浪时偶然发现了你的问题,在有人慷慨地提供了 called-interactively-p 函数的备份实现后,我的问题得到了解决。

同时,我必须承认,我很清楚在 emacs23 之前的某个地方,called-interactively 逻辑发生了变化,但直到有人将其作为错误提交之前,我才懒得去更改它。这只是一种努力优化,因为最近 Emacs 中发生了许多内部 API 更改,并且先发制人地修复它们根本不符合我的时间表。

底线是:

  1. 我将在不久的将来在 lua 模式下提供 Called-interactively-p 的备份实现,该实现将发布到下一个版本。
  2. 我鼓励您在此处提交此类故障报告。我定期阅读它们,欢迎您的报告以及您自己的黑客攻击。

干杯,
沉浸rr。

I happen to be the maintainer of lua-mode. I was lucky to stumble upon your problem when surfing on the internet and I the problem was solved after someone generously provided a backup implementation of called-interactively-p function.

Meanwhile, I must admit I was well aware that called-interactively logics were changed somewhere before emacs23, but I didn't bother changing it until someone would have filed it as a bug. This is merely an effort optimization since there've been numerous internal API changes in Emacs recently and fixing them preemptively simply doesn't fit into my timetable.

The bottomline is that:

  1. I'll provide the backup implementation of called-interactively-p within lua-mode in nearest future which will get to next release.
  2. And I'd like to encourage you to file such malfunctions as bugreports here. I'm reading them regularly and your reports as well as your own hacks are welcome upstream.

Cheers,
immerrr.

小霸王臭丫头 2024-12-03 17:40:30

我认为 Emacs 21.4 中不存在函数 `called-interactively-p'。

但实际上,我认为您谈论的是 XEmacs,而不是 GNU Emacs。请注意,这是两个不同的项目。

您应该将 XEmacs 升级到 21.5 beta 或更好的版本 (YMMV),可能使用 GNU Emacs 23。

I think the function `called-interactively-p' just did not exist in Emacs 21.4.

But actually, I think you are talking about XEmacs, not GNU Emacs. Note that these are 2 different projects.

You should upgrade your XEmacs to 21.5 beta, or better (YMMV), use GNU Emacs 23 probably.

榕城若虚 2024-12-03 17:40:30

我也有这个问题。我能够通过将其更改为:

(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))

我不能声称知道为什么会产生影响:我从其他一些逻辑推断出加载 javascript 模式,该模式使用类似的语法来描述文件扩展名。

I had this problem as well. I was able to fix it by changing it to say:

(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))

I can't claim to know why this makes a difference: I extrapolated from some other logic to load javascript mode which used a similar syntax to describe the file extension.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文