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)) (:ind . 0))
"Default options to gnuplot used by `org-plot/gnuplot'.") "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) (defun org-plot/add-options-to-plist (p options)
"Parse an OPTIONS line and set values in the property list P. "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." Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
(with-temp-file (with-temp-file
data-file data-file
(setq-local org-plot-timestamp-fmt (or (let ((org-plot-timestamp-fmt
(plist-get params :timefmt) (or
"%Y-%m-%d-%H:%M:%S")) (plist-get params :timefmt)
(insert (orgtbl-to-generic org-plot-timestamp-fmt
table "%Y-%m-%d-%H:%M:%S")))
(org-combine-plists (insert (orgtbl-to-generic
'(:sep "\t" :fmt org-plot-quote-tsv-field) table
params)))) (org-combine-plists
'(:sep "\t" :fmt org-plot-quote-tsv-field)
params)))))
nil) nil)
(defun org-plot/gnuplot-to-grid-data (table data-file params) (defun org-plot/gnuplot-to-grid-data (table data-file params)