From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iK04I3JCpmDubwAAgWs5BA (envelope-from ) for ; Thu, 20 May 2021 13:05:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 2NXYHnJCpmCuQgAAbx9fmQ (envelope-from ) for ; Thu, 20 May 2021 11:05:22 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E803A18E3C for ; Thu, 20 May 2021 13:05:21 +0200 (CEST) Received: from localhost ([::1]:54408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljgUR-0002D1-GI for larch@yhetil.org; Thu, 20 May 2021 07:05:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljgU2-0002Cq-Ij for emacs-orgmode@gnu.org; Thu, 20 May 2021 07:04:54 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:35493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljgTz-0001WB-DM for emacs-orgmode@gnu.org; Thu, 20 May 2021 07:04:54 -0400 Received: by mail-lj1-x229.google.com with SMTP id f12so19196912ljp.2 for ; Thu, 20 May 2021 04:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=YDi8lb4nM7PolX3HTHg1lwMEz0VR7eUF0O3/LAR4HRg=; b=iXFsXxJ36HIP/T3OJ5ka46E/Nf3N3EOEW4fd9SNTIEfT8gMwTp8Ff3qTiobrskQouP uM7cTVDhYpqQH+n56DgDM8srsgjYIv34nBlcVDPYcWTp4KYX0D78Z0zmcapShAnJn/Ic eSvTrGW3ypSKDgcGxKvGic/gkt2DrkyOx42zCvM9EmLsAJaBpfPJ9tPmPh6WEXDVDTSl +OO/X+G6ohB/yR1Aa97KS5H/+95nn18qKpte/IArquuqRm73ymWq8Itdqi6t+Rd4FBxX iOIATfN97ezvwxd0u0Ywz3/lN1PuZUnh2guU4DPXWtJPGj6/H0xMFTm8xPzCAHBZk7AS sOvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=YDi8lb4nM7PolX3HTHg1lwMEz0VR7eUF0O3/LAR4HRg=; b=XNOPePP8pCQFJPblSXMjVEXLGTwpzI/tLh0TcyzPAz1sDrmlHsXGCtdspDjorLXIaH CyERm2kK60mF5eKeVS0vKdacGVwWVBr3O8tWzsbkTiFQz634CPBDG1e8OHheVWyV2NJK gvJDbhAqlmoWnNd/DDQOBaob3nmmc9qqH2g8AgiMXt3MDOjlw+lAnH0WvtbVw8A7vlwK UN5j6laojZ9LBKQ3J+5TJFX6x6WySGXe6a/j+a+qzxId1dPVDfhfwX/HTbQJUUqLLEak kGBbWY8e2eAZWYynakmFiNXZTvsJ7R+tJEn89K06KnNV9ZWhMBJqjLq7A9HbvXi8mwjf dKlQ== X-Gm-Message-State: AOAM531PoKYMCYlA3NT19GqkxHurq4B/oIdplgYGqcq3LK4F2J2JRvsy yM0gz/+t+lwmdF8ffE7bZIAcGl/kdbvESnFW X-Google-Smtp-Source: ABdhPJxgK3smGBGWuvovJw4/UquORwaFzzNIJK1EXb0wVRIvlcLPcwI6yK+rmg6PQ26DYSxUwN1LMA== X-Received: by 2002:a2e:b819:: with SMTP id u25mr2611089ljo.182.1621508686004; Thu, 20 May 2021 04:04:46 -0700 (PDT) Received: from localhost ([141.105.67.194]) by smtp.gmail.com with ESMTPSA id t9sm149564lfq.208.2021.05.20.04.04.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 04:04:45 -0700 (PDT) From: Ihor Radchenko To: emacs-orgmode@gnu.org Subject: [BUG] org-babel: Binding a cons in var header arg yields error [9.4.5 (9.4.5-g914fe8 @ /home/yantar92/.emacs.d/straight/build/org/)] Date: Thu, 20 May 2021 19:09:36 +0800 Message-ID: <877djtvez3.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=yantar92@gmail.com; helo=mail-lj1-x229.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621508722; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=YDi8lb4nM7PolX3HTHg1lwMEz0VR7eUF0O3/LAR4HRg=; b=Ko28CFiJExH79PHCtNe4WObYiaVxE5E5+Y7PSWD/tH4st1gCjsiYoPakDWjUzE/fUvSjMD q/6dEfrEyuoigl+H7D9HszZYQfiuU4rNAt+59Ji0rQkL53S1+3Ktp36kPaX77a+q1RvHrG 19Mlr0FTzQacxNA+VqnqNsFqZtOO9ag/XKL4g4nuBrOIIct6+aER0wYI8Rd/0sf8cm5ZDf 9o9kPmgjVpB2TiMViI26TtL7r9edRKE7WyON5SMchZGM8FejQrUds37AkmeQlM5gnuzzhl 39WwgZyJ0w8XUiZKU+oSoegfwyowBeq3yxQUw7w+lX8swUtsqqJVQQvKkx8iVw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621508722; a=rsa-sha256; cv=none; b=ExnQb/aRNcyqDLs/0PifsNdoQZJCOdx3xgH4n3Li7pN5W+xqDfryhcnDO5srDAwwzYQ4Sd cavljPNoGrd98gsxaf+ddA9+ZDuCIci9LZdirlSz5Zu6NdprQrms7pld2rXvxYd9F2dj9q 8c+LQOcGzvMuI2hh7s2FiZ/+cIcGiq4g8CRFtzgTox/U99fdPdHsaE9pp7FCuR5zFE9dQ0 4YAefu32CEbcr01QYGRttE2vt2q/ckrwSIwsQF3HXNsDmMPa23Q7prVHWeSXS6w6jiFLwf aLeVuCJLxjTl69kHHQKf3AQ9LisBNCrHwAQx+McjTbHH3zY4Xzr9OVzX6MES2Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=iXFsXxJ3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.64 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=iXFsXxJ3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: E803A18E3C X-Spam-Score: -2.64 X-Migadu-Scanner: scn1.migadu.com X-TUID: jwYWX+7oL1l6 --=-=-= Content-Type: text/plain With the following org file on master: #+name: gen #+begin_src emacs-lisp (cons 1 2) #+end_src #+header: :var inp=gen() #+begin_src emacs-lisp inp #+end_src C-c C-c on the second code block yields: executing Emacs-Lisp code block (gen)... (1 . 2) org-babel-disassemble-tables: Wrong type argument: listp, 2 The fix is attached. Best, Ihor --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Allow-var-header-args-to-be-assigned-to-cons-cells.patch >From 761c6227e82c6e9f4d6ee701eaa0b532ac9c7916 Mon Sep 17 00:00:00 2001 Message-Id: <761c6227e82c6e9f4d6ee701eaa0b532ac9c7916.1621508858.git.yantar92@gmail.com> From: Ihor Radchenko Date: Thu, 20 May 2021 19:01:06 +0800 Subject: [PATCH] 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 857e03e55..c04bec9ae 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -1684,9 +1684,10 @@ (defun org-babel-disassemble-tables (vars hlines colnames rownames) (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 a9b8e65e5..ea7d29c4e 100644 --- a/lisp/ob-gnuplot.el +++ b/lisp/ob-gnuplot.el @@ -87,7 +87,7 @@ (defun org-babel-gnuplot-process-vars (params) (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 88ecb62b5..a5ae8e389 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -178,6 +178,22 @@ (ert-deftest test-ob/simple-variable-resolution () (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 " -- 2.26.3 --=-=-=--