[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 4c0641837c: org-babel-script-escape: Turn empty lis
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 4c0641837c: org-babel-script-escape: Turn empty lists into nil |
Date: |
Wed, 12 Oct 2022 07:57:55 -0400 (EDT) |
branch: externals/org
commit 4c0641837c8570dd8ad7f18c2482411bdc0cda16
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-babel-script-escape: Turn empty lists into nil
* lisp/ob-core.el: Translate (), {}, and [] to nil.
* testing/lisp/test-ob.el (test-ob/script-escape): Add tests.
Reported-by: Jonas Bernoulli <jonas@bernoul.li>
Link: https://list.orgmode.org/87v8opfhk1.fsf@bernoul.li/T/#u
---
lisp/ob-core.el | 2 +-
testing/lisp/test-ob.el | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 3baa6347c3..f273fa92ec 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -3124,7 +3124,7 @@ block but are passed literally to the \"example-block\"."
(error "`org-babel-script-escape' expects a string"))
(let ((escaped
(cond
- ((and (> (length str) 2)
+ ((and (>= (length str) 2)
(or (and (string-equal "[" (substring str 0 1))
(string-equal "]" (substring str -1)))
(and (string-equal "{" (substring str 0 1))
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 9051a642de..4ac278fafc 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -1962,6 +1962,11 @@ default-directory
(org-babel-execute-src-block)))))
(ert-deftest test-ob/script-escape ()
+ ;; Empty list.
+ (should (equal nil (org-babel-script-escape "[]")))
+ (should (equal nil (org-babel-script-escape "()")))
+ (should (equal nil (org-babel-script-escape "'()")))
+ (should (equal nil (org-babel-script-escape "{}")))
;; Delimited lists of numbers
(should (equal '(1 2 3)
(org-babel-script-escape "[1 2 3]")))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org 4c0641837c: org-babel-script-escape: Turn empty lists into nil,
ELPA Syncer <=