summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2014-09-15 13:47:20 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2014-09-15 13:47:20 +0200
commita927894d12060405f8499d5be022fe920501576b (patch)
tree2b339a30c06c8837e0b94ffec792a6a991fd1034
parent3aa27acfcba1a8187aaa8727a0d55624b9bbf7ee (diff)
downloadorg-mode-a927894d12060405f8499d5be022fe920501576b.tar.gz
ob-gnuplot: Fix error when table contains dates
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Dynamically bind `org-babel-gnuplot-timestamp-fmt' instead of making it buffer-local, since export takes place in another buffer anyway. Thanks to Thomas Holst for reporting it. http://permalink.gmane.org/gmane.emacs.orgmode/90709
-rw-r--r--lisp/ob-gnuplot.el18
1 files changed, 8 insertions, 10 deletions
diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
index 7d7db2a..a350186 100644
--- a/lisp/ob-gnuplot.el
+++ b/lisp/ob-gnuplot.el
@@ -64,7 +64,7 @@
(term . :any))
"Gnuplot specific header args.")
-(defvar org-babel-gnuplot-timestamp-fmt nil)
+(defvar org-babel-gnuplot-timestamp-fmt nil) ; Dynamically scoped.
(defvar *org-babel-gnuplot-missing* nil)
@@ -264,15 +264,13 @@ then create one. Return the initialized session. The current
"Export TABLE to DATA-FILE in a format readable by gnuplot.
Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
(with-temp-file data-file
- (make-local-variable 'org-babel-gnuplot-timestamp-fmt)
- (setq org-babel-gnuplot-timestamp-fmt (or
- (plist-get params :timefmt)
- "%Y-%m-%d-%H:%M:%S"))
- (insert (orgtbl-to-generic
- table
- (org-combine-plists
- '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field)
- params))))
+ (insert (let ((org-babel-gnuplot-timestamp-fmt
+ (or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S")))
+ (orgtbl-to-generic
+ table
+ (org-combine-plists
+ '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field)
+ params)))))
data-file)
(provide 'ob-gnuplot)