[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments
From: |
Vladimir Panteleev |
Subject: |
[O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments |
Date: |
Wed, 7 Mar 2018 22:58:45 +0000 |
* ob-table.el (org-sbe): (org-sbe func (x $ "a\"b\"c")) did the wrong
thing because org-sbe 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.
---
lisp/ob-table.el | 2 +-
testing/lisp/test-ob-table.el | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-table.el b/lisp/ob-table.el
index f6a5c88e4..105aca5e2 100644
--- a/lisp/ob-table.el
+++ b/lisp/ob-table.el
@@ -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))))
diff --git a/testing/lisp/test-ob-table.el b/testing/lisp/test-ob-table.el
index da136cbee..725cf6bdd 100644
--- a/testing/lisp/test-ob-table.el
+++ b/testing/lisp/test-ob-table.el
@@ -30,6 +30,16 @@
;; (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 string arguments containing
quotes."
+ (org-test-with-temp-text-in-file "
+#+name: identity
+#+begin_src emacs-lisp :eval yes
+ x
+#+end_src"
+ (should (equal "a\"b\"c"
+ (eval '(org-sbe identity (x $ "a\"b\"c")))))))
+
(provide 'test-ob-table)
;;; test-ob-table.el ends here
--
2.16.2
- [O] [PATCH 0/3] org-sbe fixes, Vladimir Panteleev, 2018/03/08
- [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments,
Vladimir Panteleev <=
- Re: [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments, Nicolas Goaziou, 2018/03/12
- Re: [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments, Vladimir Panteleev, 2018/03/13
- Re: [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments, Nicolas Goaziou, 2018/03/14
- Re: [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments, Vladimir Panteleev, 2018/03/14
- Re: [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments, Nicolas Goaziou, 2018/03/14
- Re: [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments, Vladimir Panteleev, 2018/03/14
- Re: [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments, Nicolas Goaziou, 2018/03/18
- Re: [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments, Vladimir Panteleev, 2018/03/18
- Re: [O] [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments, Nicolas Goaziou, 2018/03/18
- [O] [PATCH v2 0/3] org-sbe fixes, Vladimir Panteleev, 2018/03/18