branch: externals/org
commit 2a4fdffac163e91f6ed2055ec34cbcadf8b95dec
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>
org-plot/gnuplot-to-data: Do not assume that `orgtbl-to-generic' preserves
buffer
* lisp/org-plot.el (org-plot-timestamp-fmt): Add default value and the
docstring.
(org-plot/gnuplot-to-data): `let'-bind `org-plot-timestamp-fmt'
instead of setting it in current buffer.
Reported-by: Chris Keschnat <[email protected]>
Link: https://orgmode.org/list/[email protected]
---
lisp/org-plot.el | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index b436613b92..b045344f05 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -48,7 +48,9 @@
(:ind . 0))
"Default options to gnuplot used by `org-plot/gnuplot'.")
-(defvar org-plot-timestamp-fmt nil)
+(defvar org-plot-timestamp-fmt "%Y-%m-%d-%H:%M:%S"
+ "Default time format to be passed to Gnuplot.
+Can be changed via timefmt plot option.")
(defun org-plot/add-options-to-plist (p options)
"Parse an OPTIONS line and set values in the property list P.
@@ -130,14 +132,16 @@ will be added. Returns the resulting property list."
Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
(with-temp-file
data-file
- (setq-local org-plot-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-plot-quote-tsv-field)
- params))))
+ (let ((org-plot-timestamp-fmt
+ (or
+ (plist-get params :timefmt)
+ org-plot-timestamp-fmt
+ "%Y-%m-%d-%H:%M:%S")))
+ (insert (orgtbl-to-generic
+ table
+ (org-combine-plists
+ '(:sep "\t" :fmt org-plot-quote-tsv-field)
+ params)))))
nil)
(defun org-plot/gnuplot-to-grid-data (table data-file params)