From 4c37a937a7a770d9493ea6776530401ff053ab56 Mon Sep 17 00:00:00 2001 From: Mario Frasca Date: Sun, 2 Nov 2014 08:53:27 -0500 Subject: [PATCH] org-plot: Correction in callback registration org-plot.el (org-plot/gnuplot): Correct the callback for the and register it as soon as possible. The data-file variable is not in the scope of the callback, one needs to grab its value while registering the callback. With this patch the timer is set as soon as the file is created. Without this patch the timer is set at the end of a let-block, if anything goes wrong in the let-block before the timer is set, the file will not be removed. TINYCHANGE --- lisp/org-plot.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-plot.el b/lisp/org-plot.el index 69d925056..faa34fc38 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -294,6 +294,7 @@ line directly before or after the table." (table (org-table-to-lisp)) (num-cols (length (if (eq (first table) 'hline) (second table) (first table))))) + (run-with-idle-timer 0.1 nil #'delete-file data-file) (while (equal 'hline (first table)) (setf table (cdr table))) (when (equal (second table) 'hline) (setf params (plist-put params :labels (first table))) ;; headers to labels @@ -344,8 +345,7 @@ line directly before or after the table." (gnuplot-mode) (gnuplot-send-buffer-to-gnuplot)) ;; cleanup - (bury-buffer (get-buffer "*gnuplot*")) - (run-with-idle-timer 0.1 nil (lambda () (delete-file data-file)))))) + (bury-buffer (get-buffer "*gnuplot*"))))) (provide 'org-plot) -- 2.11.4.GIT