mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 19:07:52 +00:00
ob-table: Fix org-sbe's handling of quotes in cell values
* ob-table.el (org-sbe): org-sbe did the wrong thing when given a reference to a cell containing quotes or backslashes, because it would simply wrap any $-prefixed value in quotes, without any escaping. Fix this by using "%S" (instead of "\"%s\""). * test-ob-table.el: Add test.
This commit is contained in:
parent
e1f1acbbfb
commit
5b59e16c9e
|
@ -112,7 +112,7 @@ as shown in the example below.
|
|||
(prog1 nil (setq quote t))
|
||||
(prog1
|
||||
(cond
|
||||
(quote (format "\"%s\"" el))
|
||||
(quote (format "%S" el))
|
||||
((stringp el) (org-no-properties el))
|
||||
(t el))
|
||||
(setq quote nil))))
|
||||
|
|
|
@ -30,6 +30,28 @@
|
|||
;; (org-test-at-id "6d2ff4ce-4489-4e2a-9c65-e3f71f77d975"
|
||||
;; (should (= 2 (sbe take-sqrt (n "4"))))))
|
||||
|
||||
(ert-deftest test-ob-table/sbe-quote ()
|
||||
"Test that `org-sbe' can correctly handle cell values containing quotes."
|
||||
(org-test-table-target-expect
|
||||
"
|
||||
#+name: identity
|
||||
#+begin_src emacs-lisp :eval yes
|
||||
x
|
||||
#+end_src
|
||||
|
||||
| a\"b\"c | replace |
|
||||
"
|
||||
"
|
||||
#+name: identity
|
||||
#+begin_src emacs-lisp :eval yes
|
||||
x
|
||||
#+end_src
|
||||
|
||||
| a\"b\"c | a\"b\"c |
|
||||
"
|
||||
1
|
||||
"#+TBLFM: $2 = '(org-sbe identity (x $$1))"))
|
||||
|
||||
(provide 'test-ob-table)
|
||||
|
||||
;;; test-ob-table.el ends here
|
||||
|
|
Loading…
Reference in a new issue