---- On Mon, 19 Dec 2022 19:44:12 -0500 Rudolf Adamkovič wrote --- > Ihor Radchenko yanta...@posteo.net> writes: > > > Fixed on bugfix. > > I can confirm that the fix works. Thank you!
I can confirm it works, too, for the 1 2 3 example. However, it puts double quotes around text: #+BEGIN_SRC sh :results list echo hello echo world echo ! #+END_SRC #+RESULTS: - "hello" - "world" - "!" I was working on other ob-shell related stuff and my Emacs got into a mixed state where =ob-shell/results-list= was defined, but the fix wasn't (or wasn't loaded). I fixed the failing test before I saw this thread and Ihor's fix. The way I solved it was to wrap either =org-babel-import-elisp-from-file= or =org-babel-sh-evaluate= like, (mapcar #'car (org-babel-import-elisp-from-file tmp-file)) or (mapcar #'car (org-babel-sh-evaluate session full-body params stdin cmdline)) Doing this (without Ihor's fix in place) returns: #+BEGIN_SRC sh :results list echo "hello" echo "world" echo "!" #+END_SRC #+RESULTS: - hello - world - ! The underlying issue, so far as I understand it, is that =org-babel-import-elisp-from-file= returns a list-of-lists. For example, ((1) (2) (3)) or (("hello") ("world") ("!")). I thought it appropriate to flatten it out to (1 2 3) or ("hello" "world" "!"). Independently from how I addressed the bug, I feel it raises an important question: how should :results list handle text/strings? I'm not sure which approach is more "appropriate". If I echo a string without quotes, as I did in the first example, should it return a list that's got quotes? The hello world example is a little contrived–it's good practice to use double-quotes. I think a more realistic use case would be listing a directory. In that case, I'd probably want the list of items to be unquoted: Original: #+BEGIN_SRC sh :results list ls /home/ahab/.emacs.d/straight/repos/org/testing/lisp/ | head -n 3 #+END_SRC #+RESULTS: - ("test-ob-awk.el") - ("test-ob-C.el") - ("test-ob-clojure.el") Ihor solution: #+BEGIN_SRC sh :results list ls /home/ahab/.emacs.d/straight/repos/org/testing/lisp/ | head -n 3 #+END_SRC #+RESULTS: - "test-ob-awk.el" - "test-ob-C.el" - "test-ob-clojure.el" MAPCAR solution: #+BEGIN_SRC sh :results list ls /home/ahab/.emacs.d/straight/repos/org/testing/lisp/ | head -n 3 #+END_SRC #+RESULTS: - test-ob-awk.el - test-ob-C.el - test-ob-clojure.el For :results list, the manual says, "Interpret the results as an Org list. If the result is a single value, create a list of one element". I don't find that clarifies what would be best. Thoughts?