emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals-release/org c614234688 1/2: ob-gnuplot: Use org backend


From: ELPA Syncer
Subject: [elpa] externals-release/org c614234688 1/2: ob-gnuplot: Use org backend when assigning table to variable
Date: Wed, 29 Dec 2021 22:57:42 -0500 (EST)

branch: externals-release/org
commit c6142346888d43fc0d2f828818bc15dbccd59b72
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    ob-gnuplot: Use org backend when assigning table to variable
    
    * lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Switch to 'org
    backend when exporting table data to plain text table.  ascii backend
    incorrectly handles quote transcoders that change the column width and
    sometimes throws an error.  (ascii backend simply ignores transcoded
    table cells and calculates width based on the initial cell text).
---
 lisp/ob-gnuplot.el | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
index 8c4a5957b9..b72126ae5f 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]