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

时间:2015-06-13 00:25:55

标签: emacs gnuplot org-mode

每当我在emacs org-mode中调用命令org-plot/gnuplot时,我都会收到相同的错误Error running timer: (void-variable data-file)。我在Debian Jessie中使用emacs 24.4.1以及在Mac Os上使用emacs 24.5。两个系统都有一个gnuplot的工作版本。我甚至在运行没有.emacs文件的emacs时尝试此命令,但仍然会收到同样的错误。

2 个答案:

答案 0 :(得分:5)

这是一个错误。函数org-plot / gnuplot(在org-plot.el中)尚未更新以考虑词法范围的变量。您可以通过首先找到org-plot.el源文件来修复emacs安装中的假设(假设您安装了.el文件)(一种方法是

m-x apropos ^org-plot/gnuplot$ 

然后单击结果顶部的文件链接)并替换org-plot / gnuplot函数中的最后一个表达式(使用c-m-f快速结束)

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

改为阅读

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

原始代码期望lambda关闭动态数据文件变量,但它现在是词法。我的替换代码将值直接传递给lambda。

您必须保存修改后的文件,然后使用

重新编译它
m-x byte-compile-file

或者您只是看到.el文件较新的警告(但无论如何它都会加载带有旧代码的.elc)。

如果在较新版本的组织中修复此问题,我不会感到惊讶,但我还没有检查过。

答案 1 :(得分:2)

编辑:发现它!请参阅以下原始答案。在其中,我找到了引用data-file的行。围绕该行的原始源文件中的注释提到为了容纳gnuplot 4而进行了更改。这与@ vu-nguyen的评论一起促使我下载并编译gnuplot 4.6.7

我编译并安装了它:

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

它开始工作了。

原始答案

我删除了我的elpa文件夹并重新安装了我的elpa软件包,以确保我没有使用"脏"包文件夹。编辑:我甚至卸载了gnuplot软件包的最新版本并安装了旧版本(201403170.6.6),但没有任何帮助。

看起来唯一谈论data-file的包是gnuplot:

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

也许这是一个错误?