emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 54c2327 49/85: Allow :var header args to be assigne


From: ELPA Syncer
Subject: [elpa] externals/org 54c2327 49/85: Allow :var header args to be assigned to cons cells
Date: Mon, 27 Sep 2021 15:57:48 -0400 (EDT)

branch: externals/org
commit 54c2327f3abe6b9793014c4117b6294a4390c63e
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Bastien <bzg@gnu.org>

    Allow :var header args to be assigned to cons cells
    
    * lisp/ob-core.el (org-babel-disassemble-tables,
    org-babel-gnuplot-process-vars): Use `proper-list-p' check instead of
    `listp'.
    (org-babel-disassemble-tables): Check list length before trying to
    remove hline from a table assignment.
    * testing/lisp/test-ob.el (test-ob/cons-cell-as-variable): Add the
    test.
---
 lisp/ob-core.el         |  5 +++--
 lisp/ob-gnuplot.el      |  2 +-
 testing/lisp/test-ob.el | 16 ++++++++++++++++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index f325228..03d2b56 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -1712,9 +1712,10 @@ of the vars, cnames and rnames."
     (list
      (mapcar
       (lambda (var)
-        (when (listp (cdr var))
+        (when (proper-list-p (cdr var))
           (when (and (not (equal colnames "no"))
-                     (or colnames (and (eq (nth 1 (cdr var)) 'hline)
+                     (or colnames (and (length> (cdr var) 1)
+                                       (eq (nth 1 (cdr var)) 'hline)
                                        (not (member 'hline (cddr (cdr 
var)))))))
             (let ((both (org-babel-get-colnames (cdr var))))
               (setq cnames (cons (cons (car var) (cdr both))
diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
index 2ed1ad8..4008f5c 100644
--- a/lisp/ob-gnuplot.el
+++ b/lisp/ob-gnuplot.el
@@ -88,7 +88,7 @@ code."
        (cons
        (car pair) ;; variable name
        (let* ((val (cdr pair)) ;; variable value
-              (lp  (listp val)))
+              (lp  (proper-list-p val)))
          (if lp
              (org-babel-gnuplot-table-to-data
               (let* ((first  (car val))
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 88ecb62..a5ae8e3 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -178,6 +178,22 @@ should still return the link."
                            (point-at-bol)
                            (point-at-eol))))))
 
+(ert-deftest test-ob/cons-cell-as-variable ()
+  "Test that cons cell can be assigned as variable."
+  (org-test-with-temp-text "
+
+#+name: cons
+#+begin_src emacs-lisp
+  (cons 1 2)
+#+end_src
+
+#+begin_src emacs-lisp :var x=cons
+  x
+#+end_src"
+
+    (org-babel-next-src-block 2)
+    (should (equal (cons 1 2) (org-babel-execute-src-block)))))
+
 (ert-deftest test-ob/multi-line-header-arguments ()
   "Test that multi-line header arguments and can be read."
   (org-test-with-temp-text-in-file "



reply via email to

[Prev in Thread] Current Thread [Next in Thread]