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

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

[elpa] externals/org 18fec7623c: ob-core: Fix :results list when result


From: ELPA Syncer
Subject: [elpa] externals/org 18fec7623c: ob-core: Fix :results list when result is a table
Date: Sun, 18 Dec 2022 06:57:55 -0500 (EST)

branch: externals/org
commit 18fec7623cad7b73f7b741ad9b40f709c008c7db
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    ob-core: Fix :results list when result is a table
    
    * lisp/ob-core.el (org-babel-insert-result): Do not treat table lines
    in RESULT verbatim.
    * testing/lisp/test-ob-shell.el (ob-shell/results-list): Add new test.
    
    Reported-by: Rudolf Adamkovič <salutis@me.com>
    Link: https://orgmode.org/list/m2tu1v8gj8.fsf@me.com
---
 lisp/ob-core.el               |  6 +++++-
 testing/lisp/test-ob-shell.el | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 2fa9d8978d..3c7717fd8f 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2463,7 +2463,11 @@ INFO may provide the values of these header arguments 
(in the
                       (cons 'unordered
                             (mapcar
                              (lambda (e)
-                               (list (if (stringp e) e (format "%S" e))))
+                                (cond
+                                 ((stringp e) (list e))
+                                 ((listp e)
+                                  (mapcar (lambda (x) (format "%S" x)) e))
+                                 (t (list (format "%S" e)))))
                              (if (listp result) result
                                (split-string result "\n" t))))
                       '(:splicep nil :istart "- " :iend "\n")))
diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el
index 7aa45cc8a2..b0d9beff46 100644
--- a/testing/lisp/test-ob-shell.el
+++ b/testing/lisp/test-ob-shell.el
@@ -170,6 +170,20 @@ ob-comint.el, which was not previously tested."
              "#+BEGIN_SRC sh :results table\necho 'I \"want\" it 
all'\n#+END_SRC"
            (org-babel-execute-src-block)))))
 
+(ert-deftest ob-shell/results-list ()
+  "Test :results list."
+  (org-test-with-temp-text
+      "#+BEGIN_SRC sh :results list\necho 1\necho 2\necho 3\n#+END_SRC"
+    (should
+     (equal '((1) (2) (3))
+            (org-babel-execute-src-block)))
+    (search-forward "#+results")
+    (beginning-of-line 2)
+    (should
+     (equal
+      "- 1\n- 2\n- 3\n"
+      (buffer-substring-no-properties (point) (point-max))))))
+
 ;;; Standard output
 
 (ert-deftest ob-shell/standard-output-after-success ()



reply via email to

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