简体   繁体   English

Emacs org-mode gnuplot:运行计时器时出错:(void-variable data-file)

[英]Emacs org-mode gnuplot : Error running timer: (void-variable data-file)

Whenever I call the command org-plot/gnuplot in emacs org-mode, I get the same error Error running timer: (void-variable data-file) . 每当我在emacs org-mode中调用命令org-plot/gnuplot时,我得到相同的错误Error running timer: (void-variable data-file) I am using emacs 24.4.1 in Debian Jessie as well as emacs 24.5 on a Mac Os. 我在Debian Jessie中使用emacs 24.4.1以及在Mac Os上使用emacs 24.5。 Both systems have a working version of gnuplot. 两个系统都有一个gnuplot的工作版本。 I even try this command when running emacs with no .emacs files and still get this same error. 我甚至在运行没有.emacs文件的emacs时尝试此命令,但仍然会收到同样的错误。

It is a bug. 这是一个错误。 The function org-plot/gnuplot (in org-plot.el) hasn't yet been updated to account for lexically-scoped variables. 函数org-plot / gnuplot(在org-plot.el中)尚未更新以考虑词法范围的变量。 You can fix it in your emacs installation (assuming you have the .el files installed) by first finding the org-plot.el source file (one way is to do 你可以通过首先找到org-plot.el源文件来修复你的emacs安装(假设安装了.el文件)(一种方法是做)

m-x apropos ^org-plot/gnuplot$ 

and then clicking on the file link at the top of the result) and replacing the last expression in the org-plot/gnuplot function (use cmf to get to the end quickly) 然后单击结果顶部的文件链接并替换org-plot / gnuplot函数中的最后一个表达式(使用cmf快速结束)

(run-with-idle-timer 0.1 nil (lambda () (delete-file data-file)))

to instead read 改为阅读

(run-with-idle-timer 0.1 nil (lambda (data-file) (delete-file data-file)) data-file)

The original code was expecting the lambda to close over the dynamic data-file variable, but it is now lexical. 原始代码期望lambda关闭动态数据文件变量,但它现在是词法。 My replacement code passes the value directly into the lambda. 我的替换代码将值直接传递给lambda。

You will have to save the modified file and then recompile it with 您必须保存修改后的文件,然后重新编译它

m-x byte-compile-file

or you'll just see a warning that the .el file is newer (but it will load the .elc with the old code anyway). 或者您只是看到.el文件较新的警告(但它会使用旧代码加载.elc)。

I wouldn't be surprised if this is fixed in newer versions of org, but I haven't checked. 如果在较新版本的组织中修复此问题,我不会感到惊讶,但我没有检查过。

EDIT: Found it! 编辑:找到它! See original answer below. 请参阅以下原始答案。 In it, I find the line which refers to data-file . 在其中,我找到了引用data-file The comments in the original source file around that line mention that changes were made to accomodate gnuplot 4. That, together with @vu-nguyen's comment, led me to download and compile gnuplot 4.6.7 . 围绕该行的原始源文件中的注释提到了更改以适应gnuplot 4.这与@ vu-nguyen的注释一起促使我下载并编译gnuplot 4.6.7

I compiled and installed it thus: 我编译并安装它:

./configure --with-cwdrc --with-readline=gnu --enable-backwards-compatibility
make
sudo make install

And it started working. 它开始工作了。

Original Answer 原始答案

I deleted my elpa folder and reinstalled my elpa packages to make sure I wasn't using "dirty" package folders. 我删除了我的elpa文件夹并重新安装了我的elpa软件包,以确保我没有使用“脏”软件包文件夹。 EDIT: I even uninstalled the newest version of the gnuplot package and installed older versions ( 20140317 and 0.6.6 ) but nothing helped. 编辑:我甚至卸载了最新版本的gnuplot软件包并安装了旧版本( 201403170.6.6 ),但没有任何帮助。

It looks like the only package that talks about data-file is gnuplot: 它看起来像是谈论data-file的唯一包是gnuplot:

gnuplot.el:2820: ("(gnuplot)data-file" nil "[_a-zA-Z0-9]+")

Maybe it is a bug? 也许这是一个错误?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM