org-babel-import-elisp-from-file: Fix when \"s are not around

* lisp/ob-core.el (org-babel-string-read): Only considered \" at the
string boundaries, not inside.
* testing/lisp/test-ob-shell.el (ob-shell/results-table): Add a test.
This commit is contained in:
Ihor Radchenko 2022-10-23 14:30:57 +08:00
parent f8a9cd2308
commit 9a3dd429bb
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 10 additions and 1 deletions

View File

@ -3205,7 +3205,7 @@ If the table is trivial, then return it as a scalar."
(defun org-babel-string-read (cell)
"Strip nested \"s from around strings."
(org-babel-read (or (and (stringp cell)
(string-match "\"\\(.+\\)\"" cell)
(string-match "^[[:space:]]*\"\\(.+\\)\"[[:space:]]*$" cell)
(match-string 1 cell))
cell) t))

View File

@ -162,6 +162,15 @@ ob-comint.el, which was not previously tested."
"\nhello tramp from " (file-local-name default-directory))))
(should (equal result expected)))))))
(ert-deftest ob-shell/results-table ()
"Test :results table."
(should
(equal '(("I \"want\" it all"))
(org-test-with-temp-text
"#+BEGIN_SRC sh :results table\necho 'I \"want\" it all'\n#+END_SRC"
(org-babel-execute-src-block)))))
(provide 'test-ob-shell)
;;; test-ob-shell.el ends here