diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el index 8c4a5957b..b72126ae5 100644 --- a/lisp/ob-gnuplot.el +++ b/lisp/ob-gnuplot.el @@ -287,11 +287,21 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE." (with-temp-file data-file (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 :raw t :backend ascii) - params))))) + (replace-regexp-in-string + ;; org export backend adds "|" at the beginning/end of + ;; the table lines. Strip those. + "^|\\(.+\\)|$" + "\\1" + (orgtbl-to-generic + table + (org-combine-plists + '( :sep "\t" :fmt org-babel-gnuplot-quote-tsv-field + ;; Two setting below are needed to make :fmt work. + :raw t + ;; Use `org', not `ascii' because `ascii' may + ;; sometimes mishandle quoted strings. + :backend org) + params)))))) data-file) (provide 'ob-gnuplot)