summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Frasca <mrgsfrasca@gmail.com>2014-11-02 08:53:27 -0500
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2014-11-08 21:38:52 +0100
commit4c37a937a7a770d9493ea6776530401ff053ab56 (patch)
tree7f339366390a16d98811fb1d87535d642d845640
parent9f28685b29e21517dd2d4b870fec835929be882f (diff)
downloadorg-mode-4c37a937a7a770d9493ea6776530401ff053ab56.tar.gz
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
-rw-r--r--lisp/org-plot.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 69d9250..faa34fc 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)