From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id UGQeD7X2S2P+zgAAbAwnHQ (envelope-from ) for ; Sun, 16 Oct 2022 14:19:01 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kKVCD7X2S2NCOQAA9RJhRA (envelope-from ) for ; Sun, 16 Oct 2022 14:19:01 +0200 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 3475820CE5 for ; Sun, 16 Oct 2022 14:19:00 +0200 (CEST) Received: from localhost ([::1]:40692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ok2ba-0004Di-Un for larch@yhetil.org; Sun, 16 Oct 2022 08:18:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ok2aq-0004DX-SW for emacs-orgmode@gnu.org; Sun, 16 Oct 2022 08:18:12 -0400 Received: from pie.tf ([5.45.99.52]:42882) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ok2ap-0006d9-1f for emacs-orgmode@gnu.org; Sun, 16 Oct 2022 08:18:12 -0400 Received: from i59f4c624.versanet.de ([89.244.198.36] helo=localhost) by pie.tf with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ok2ag-00006Q-7A; Sun, 16 Oct 2022 12:18:02 +0000 From: Ferdinand Pieper To: emacs-orgmode@gnu.org Subject: [PATCH] Add light argument to org-babel-lob-get-info Date: Sun, 16 Oct 2022 14:17:51 +0200 Message-ID: <877d109d3k.fsf@ims.uni-hannover.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=5.45.99.52; envelope-from=fer@pie.tf; helo=pie.tf X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-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.29 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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665922740; 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; bh=pnNfu+gvirmCs1lmgISaem6+mnfloa+QhAFAdvGrB/A=; b=mTY332/TpxHBdO2mlq4ybjiUoRHPzK3jovrRcbQRPJlLPoVZOR637MlTydKy+ujE5+wcfH Er6k15fG0aNJ/izInLpbjAo8BbB3onfjBo7kbb1NmTinIX1LGxhrUeMlxSPjoC08tBl8Hm uvERv9WDgmkQ5FDLcWHvPpGzWy3OFwpVikUC1i3AIVhDIlgEWo+BOrF5LuOTqnn9yxJZ6x 9jTsuyHDSU5Djk5KRs4rKGboxRkGOVMYu46m7soFhZAtI5CF9jjC+jeNPUquCKuYaJDBwK TMyGRm5a+hlqf1Y8WambiyORRGvSUhBpsvkXpDVoZCIGUu398O2LiO1pG7ArEw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665922740; a=rsa-sha256; cv=none; b=hegHF6djzoNFMMWmGRfi3fbAeFlQ/25AmGIGZgelOtkp6gZOZI+TOfB1uDYb8gdOj/RDtR a90q9N2wRz2/u5VtPo25EDWUxlismWhz54sx4zRhFE9I+3OUxmQoFIu3iDD5PMr2Zfwhio B9X9sHII29jAw2n1PGerF+UKzJwkWbK4MGt6RWKLpDN9el+Q0DaQ4UZVpnY0Tt1PvxNbXm fUxMyHNOythHZvw/WjDFkltznNLrCYxBFBb/sOYDFcQP5qskjewHILADLGYP/zFP8IXINx 3lbmVpXNPAxhOvTwgKXWoop6eU42VUj7o1pNiZP+GlwV/QLre4NDr0YyWzPs2A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.20 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 3475820CE5 X-Spam-Score: -1.20 X-Migadu-Scanner: scn1.migadu.com X-TUID: STPriSUGYVNF --=-=-= Content-Type: text/plain Similar to ~org-babel-get-src-block-info~ it is sometimes useful to disable evaluation of lisp parameters when getting the info of a lob call. This patch adds an argument for that. Better name for the argument could be ~no-eval~, but I decided to stick with the naming in ~org-babel-get-src-block-info~. To be completely consistent with ~org-babel-get-src-block-info~ the argument order could be swapped, but this would break existing function calls. What do you think? Best, Ferdinand --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-babel-lob-get-info-Add-light-argument.patch >From ba8069a3b83489ee1de8c4eeba059883809d0ea7 Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 16 Oct 2022 13:17:40 +0200 Subject: [PATCH] org-babel-lob-get-info: Add light argument * lisp/ob-lob.el (org-babel-lob-get-info): Add light argument to prevent recursive evaluation of lisp values in parameters. --- lisp/ob-exp.el | 2 +- lisp/ob-lob.el | 13 +++++++++---- lisp/ob-ref.el | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index e9b304b86..83dd5fc74 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -25,7 +25,7 @@ ;;; Code: (require 'ob-core) -(declare-function org-babel-lob-get-info "ob-lob" (&optional datum)) +(declare-function org-babel-lob-get-info "ob-lob" (&optional datum light)) (declare-function org-element-at-point "org-element" ()) (declare-function org-element-context "org-element" (&optional element)) (declare-function org-element-property "org-element" (property element)) diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el index 903dabfbd..3043ff647 100644 --- a/lisp/ob-lob.el +++ b/lisp/ob-lob.el @@ -114,11 +114,16 @@ after REF in the Library of Babel." (cdr (assoc-string ref org-babel-library-of-babel)))))))) ;;;###autoload -(defun org-babel-lob-get-info (&optional datum) +(defun org-babel-lob-get-info (&optional datum light) "Return internal representation for Library of Babel function call. Consider DATUM, when provided, or element at point otherwise. +When optional argument LIGHT is non-nil, Babel does not resolve +remote variable references; a process which could likely result +in the execution of other code blocks, and do not evaluate Lisp +values in parameters. + Return nil when not on an appropriate location. Otherwise return a list compatible with `org-babel-get-src-block-info', which see." @@ -139,16 +144,16 @@ see." org-babel-default-lob-header-args (append (org-with-point-at begin - (org-babel-params-from-properties language)) + (org-babel-params-from-properties language light)) (list (org-babel-parse-header-arguments - (org-element-property :inside-header context)) + (org-element-property :inside-header context) light) (let ((args (org-element-property :arguments context))) (and args (mapcar (lambda (ref) (cons :var ref)) (org-babel-ref-split-args args)))) (org-babel-parse-header-arguments - (org-element-property :end-header context))))) + (org-element-property :end-header context) light)))) nil (org-element-property :name context) begin diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el index a7ab299b2..a7cdb22e1 100644 --- a/lisp/ob-ref.el +++ b/lisp/ob-ref.el @@ -53,7 +53,7 @@ (require 'org-macs) (require 'cl-lib) -(declare-function org-babel-lob-get-info "ob-lob" (&optional datum)) +(declare-function org-babel-lob-get-info "ob-lob" (&optional datum light)) (declare-function org-element-at-point "org-element" ()) (declare-function org-element-property "org-element" (property element)) (declare-function org-element-type "org-element" (element)) -- 2.20.1 --=-=-=--