From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GL73CQq6yGLqbwEAbAwnHQ (envelope-from ) for ; Sat, 09 Jul 2022 01:13:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YOrOCQq6yGIVCQAA9RJhRA (envelope-from ) for ; Sat, 09 Jul 2022 01:13:14 +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 B650511D5A for ; Sat, 9 Jul 2022 01:13:13 +0200 (CEST) Received: from localhost ([::1]:52290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9x9r-0004B9-PR for larch@yhetil.org; Fri, 08 Jul 2022 19:13:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9x8v-0004B0-7f for emacs-orgmode@gnu.org; Fri, 08 Jul 2022 19:12:13 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:46951) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9x8t-0006AC-In for emacs-orgmode@gnu.org; Fri, 08 Jul 2022 19:12:12 -0400 Received: by mail-pl1-x62b.google.com with SMTP id l12so4774plk.13 for ; Fri, 08 Jul 2022 16:12:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=oNSE/3jHX942iZglsnoC1YN8zFIiKBk5N5J/9IN2PKo=; b=S79b4ywXZgZjvs1yin7fp6Tk7pbRtVcgFm78NJgqu2Lva5nj3TNNrw84PXkbGKtEXc UcS/bC49NNnduSaiAG4fW9OtcSpmgec15FhOMP4XrX/GKXoLfyAeTjTyITQ82aPQmHr/ 5lZDnNecZR0VB1GEHDc7rgSIAKwJ7St6N2fUrbCXZ0rmqDAGh3iYCVUvEqWr42xHJa/+ HBp4ncMjUwVag79VXMAgXhsp7b3thF0Cdn0B7NyAQE3ya5nP5uaH6Ad5YkguuGRMNUsp ogTjX+1zSo6ndcvR1a+qhuN3kNb78ctwc2axOXRhdwIYSxyzDtCTtxEcqgrL3TEWM5k2 FvBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:cc:subject:in-reply-to:references :date:message-id:mime-version; bh=oNSE/3jHX942iZglsnoC1YN8zFIiKBk5N5J/9IN2PKo=; b=rITG7kqrNBpvy3TSV3qB+3Ljcb2thu7ModDB5eEIpppL8nL22VdXKo+QDrdUka8jCR tF9FjUI5RnnV5fp+hPVeq3F70AOmaQ5H3mwdWVrNKfmT22IycY+9j+iss5AbSTHTEPo0 YXSLK7c2BfqfLt/g9AQp6/2bUThXcCB9X9E57MW/eZSkA0iPQTEtk897z/rAyUrBEZ0u g6/IkGGCdqpixQ430ej5rDyxzjl3XZRh8mWp2BE45Dnql0+vJa29BFtuFVJBjpXEuVVz ZLu3x0rjiA0sSZWP860U5gN57y85TrbfKkxKMZo8R2VciarIwF5pBb6lCHT2jINUR057 mNdg== X-Gm-Message-State: AJIora+bwuBfypdB2zirHP79C9qxQBH+uufJ9yGuMdH8g3Al+W7zKiMO XaqQt8NE0ngMQMcCI+Yt+b33rT6hbrI= X-Google-Smtp-Source: AGRyM1tJIW7HBu5nembpd+PNyw7Yv2eqGYGC1ek58H+iFxEAtHY9M8Fb79rTogkQJK6Um8IdeEXgnw== X-Received: by 2002:a17:90a:e7c3:b0:1ef:bd2c:539d with SMTP id kb3-20020a17090ae7c300b001efbd2c539dmr2554386pjb.212.1657321929076; Fri, 08 Jul 2022 16:12:09 -0700 (PDT) Received: from ryzen3950 (c-208-82-98-189.rev.sailinternet.net. [208.82.98.189]) by smtp.gmail.com with ESMTPSA id t10-20020a170902e84a00b0016bdeb58611sm65183plg.112.2022.07.08.16.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 16:12:07 -0700 (PDT) From: Matt Huszagh To: Ihor Radchenko Cc: "emacs-orgmode@gnu.org" Cc: Subject: Re: [PATCH] Fix behavior of lambda default header arg vars In-Reply-To: <87wnczkcsg.fsf@localhost> References: <87o87abjm5.fsf@gmail.com> <87ee035mnp.fsf@localhost> <87ee03je2m.fsf@gmail.com> <87wndnq5kw.fsf@localhost> <8735fpv3yf.fsf@gmail.com> <87wnczkcsg.fsf@localhost> Date: Fri, 08 Jul 2022 16:12:06 -0700 Message-ID: <875yk76vy1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=huszaghmatt@gmail.com; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1657321994; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=oNSE/3jHX942iZglsnoC1YN8zFIiKBk5N5J/9IN2PKo=; b=N9TMiXBcpgtA438PJPYF+SgtQHwWNm5RuYO9aIduiEsWZNOgPmH9uJamc3AuOuvuSlhYV6 WevpQAorsIfgBL0KTDiJefUFbRNsc0saGYVUPmgqnKR6XWzl+fPtVrMstuOJML0V7+ANUM HCSmqMfgZeDIoD7mFeuCGsKzJ4wldaBWoe8auwKXnHfVDOCdafThKf/mNtmcEUZhEY/BzU FFUiBlGF7O0Dj+bZviTjis2YTSQRa5y+SkuefB//VkQXHibTDqs6+oRWSY0bgEKmQ+j6TF 643M0exjV51/YKFPsyi0ubZBgXmHLQ4dgPLS6t+hECPcQrYA86+VF8aKLEpANQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657321994; a=rsa-sha256; cv=none; b=axUhIMpUyZc4I7y6XlkmGooGejn3TaX11Bt+lOxbfoaoAE4F7/cAW4Rsy2WlIaOXfmoU+K Luhwp4wSQMV6qkF9HxsqzQHNRG2ibCitI1r/wzKyOAxNX4nFLV4v8NQouUisw/QxbnF5JC atu2Q9KtU/MrzIeEWv7rriq+ik1H2tqTn1oRYrbmWVJDGYB4MXCKk2MBTQVS7uu4DVLQXl 49/XFfKfAkm3TTKZKWfnppVhT0dxSi8okWGNYwZz6oYEsDyyQzRgtWdenvtrg7YFJrMIqZ wfmYWdLYuDxl3FOaOvsSL3bXXs8iss0EE3dXtzE2gQecEIKEhL8lorhRySSp/Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=S79b4ywX; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: 6.95 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=S79b4ywX; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: B650511D5A X-Spam-Score: 6.95 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3II6ziiahgfV --=-=-= Content-Type: text/plain Ihor Radchenko writes: > This patch does not apply. It does not appear to be based on the > original main branch: > > Applying: ob-core.el: Improve org-babel-default-header-args docstring > error: sha1 information is lacking or useless (lisp/ob-core.el). > error: could not build fake ancestor My mistake. Try these. Matt --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ob-core.el-Fix-behavior-of-lambda-default-header-arg.patch >From 6894d7b441fe975bc90177d85102c031cffe3c46 Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Mon, 27 Jun 2022 20:41:02 -0700 Subject: [PATCH 1/2] ob-core.el: Fix behavior of lambda default header arg vars * lisp/ob-core.el: Permit multiple :var default header arguments when using closures. --- lisp/ob-core.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 75a6a167d..0d9ec5c84 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2749,6 +2749,11 @@ parameters when merging lists." (pcase pair (`(:var . ,value) (let ((name (cond + ;; Default header arguments can accept lambda + ;; functions. We uniquely identify the var + ;; according to the full string contents of + ;; the lambda function. + ((functionp value) value) ((listp value) (car value)) ((string-match "^\\([^= \f\t\n\r\v]+\\)[ \t]*=" value) (intern (match-string 1 value))) -- 2.31.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-ob-core.el-Improve-org-babel-default-header-args-doc.patch >From 12833bc6c089af9d94c9535835e0a68d189c8496 Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Mon, 27 Jun 2022 20:42:27 -0700 Subject: [PATCH 2/2] ob-core.el: Improve org-babel-default-header-args docstring * lisp/ob-core.el: Provide example illustrating one benefit of using closures as default header arguments. Additionally, explain how to provide the same type of header argument multiple times in the default alist. --- lisp/ob-core.el | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 0d9ec5c84..d85c66e76 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -482,12 +482,14 @@ For the format of SAFE-LIST, see `org-babel-safe-header-args'." This is a list in which each element is an alist. Each key corresponds to a header argument, and each value to that header's value. The value can either be a string or a closure that -evaluates to a string. The closure is evaluated when the source -block is being evaluated (e.g. during execution or export), with -point at the source block. It is not possible to use an -arbitrary function symbol (e.g. \\='some-func), since org uses -lexical binding. To achieve the same functionality, call the -function within a closure (e.g. (lambda () (some-func))). +evaluates to a string. + +A closure is evaluated when the source block is being +evaluated (e.g. during execution or export), with point at the +source block. It is not possible to use an arbitrary function +symbol (e.g. 'some-func), since org uses lexical binding. To +achieve the same functionality, call the function within a +closure (e.g. (lambda () (some-func))). To understand how closures can be used as default header arguments, imagine you'd like to set the file name output of a @@ -504,7 +506,16 @@ this with: Because the closure is evaluated with point at the source block, the call to `org-element-at-point' above will always retrieve -information about the current source block.") +information about the current source block. + +Some header arguments can be provided multiple times for a source +block. An example of such a header argument is :var. This +functionality is also supported for default header arguments by +providing the header argument multiple times in the alist. For +example: + +'((:var . \"foo=\\\"bar\\\"\") + (:var . \"bar=\\\"foo\\\"\"))") (put 'org-babel-default-header-args 'safe-local-variable (org-babel-header-args-safe-fn org-babel-safe-header-args)) -- 2.31.1 --=-=-=--