1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00

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 <chris@catsu.it>
Link: https://orgmode.org/list/87r0bje1vs.fsf@catsu.it
This commit is contained in:
Ihor Radchenko 2024-07-24 12:31:32 +02:00
parent 114c764035
commit 2a4fdffac1
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -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
(let ((org-plot-timestamp-fmt
(or
(plist-get params :timefmt)
"%Y-%m-%d-%H:%M:%S"))
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))))
params)))))
nil)
(defun org-plot/gnuplot-to-grid-data (table data-file params)