From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id cDG+LNOZ3GQvfQEASxT56A (envelope-from ) for ; Wed, 16 Aug 2023 11:41:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SKFnLNOZ3GQhcwAAauVa8A (envelope-from ) for ; Wed, 16 Aug 2023 11:41:39 +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 5B9134F65B for ; Wed, 16 Aug 2023 11:41:39 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=fuz87Z29; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692178899; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=jx3Vxeac2frvAOPuYo55S9kaT4GgKdNN9a/zHR2Q2W8=; b=AM3C2ZrNKs7fhZQT9I81JVFn0H3jTjLJrK6br8aoD730zr1CboKcZOwqsIxIht//dSrj1F 9zSnIowXQ/rrX7yBkv7RFC1VUwjboT1TTOFwwI/L/xgYr+6RCwAm7+7z/SEYXq1L6ivMLY vaQ0ctDRfDZST2mxtkkgxtbAVb874G2h95uLW08Jag7BW3iF45RYJyYW9SbevsV8KERiMI muI1je+SZvqWFHKjccgejHPKw5szzqcS96OZ7n8CJvK8M6diAZs2B4Fxxz+SDqHj2NoXdW P4UavtF0lligdWBOEReX9npXL7UzCBcS6v/63CHYEk7+5tkxvMQn4QR8E0krBw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=fuz87Z29; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692178899; a=rsa-sha256; cv=none; b=kRZh/w4l/Wuukwiqivb+fss/4jwUu9pbl9ghugAkNs4yT9mkg43Gq84GgjaSECM25A3C5n ad+tZl9dl1snoSa4uE1eUaqq45Qw1Q5VYQz763Q7u4H1FX9DeykY3GpY1zqfLsoe/DbuZI jSr1xnks9XbeGJYhB9tHuSKZ9RISdzbkmdGjoSH0TIFM51NMMKMd4XVZ/elrwGjREx5GJd QdD7yEx4EYsDQ3Wk8zDOhnlrVp+gm70+lR3eHpTatt8ELxA9/lbPiqLTarDcRQnmU/PI9N 7Dlljje7H31+9tdCqMtW/TO9S3S9VFJ71/rQMkLx3MVBgVrMw3gnNfdt0F7wNg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWD1W-0004yI-Ok; Wed, 16 Aug 2023 05:41:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWD1Q-0004y1-MS for emacs-orgmode@gnu.org; Wed, 16 Aug 2023 05:41:00 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWD1L-0003Cs-JP for emacs-orgmode@gnu.org; Wed, 16 Aug 2023 05:40:59 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id BB49C240029 for ; Wed, 16 Aug 2023 11:40:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692178852; bh=wYTlDOI4rmNS4fstGJpoJkWqamcyBaIcyh8Mkr+p4Js=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=fuz87Z290csrYvIkJlWQFwESH8Xwxd5eVB59PaGA7ncXptola/Lw9WELBEMBenQOg KzqTnqY3fsd8jQ87vU88y8qWEyU7E+DBr9OXSNx/cDLqXCRp4ISC6nPWqIEny6O6RF feDcnOISMhTLVTXRAQWjPaQN7w8GwxbECdQMxxo1PlRLljYfJNSRUQh5FHYDcbwgfB 81jwegfAEidx9wxGOsm3TrD9uXyd33XeLgOBP6rEh6nDTNOfYB0aq0TZV8ogMEpqD9 tlb+jlfuSz6Gk4jgPwhwW6lnhAUmguEqDjWSVPbhpHnWKWqbJaaKXSbeRHoJtOCwr9 scmHyAtOciQWQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RQjn00kdSz9rxD; Wed, 16 Aug 2023 11:40:51 +0200 (CEST) From: Ihor Radchenko To: Tom Gillespie Cc: emacs-orgmode Subject: Re: [PATCH] ob-tangle.el: restore :tangle closure nil behavior In-Reply-To: References: <877cpvpd4i.fsf@localhost> Date: Wed, 16 Aug 2023 09:41:20 +0000 Message-ID: <87y1ibnx33.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 5B9134F65B X-Migadu-Scanner: mx1.migadu.com X-Spam-Score: -6.68 X-Migadu-Spam-Score: -6.68 X-TUID: Q3KFvAcVVUs5 Tom Gillespie writes: >> What do you mean by "restore"? Were it evaluated in the past? >> May you please provide a reproducer? > > Hrm. I think I may have mixed two commit lines. It is the case that > :tangle closures used to work, but you are right, the historical behavior > when tangling closures meant that all parameters were evaluated (tested > with the block below in 27 and 28). > > #+begin_src elisp :var value=(error "oops") :tangle (or "no") > value > #+end_src This example clearly shows that evaluating everything is a bad idea. :var has no effect during tangling anyway. > My use case is that I have blocks that I want to tangle that set :var > from e.g. the library of babel, which isn't always loaded, but which also > is not required if :tangle is no. My confusion about you patch comes from the fact that #+begin_src emacs-lisp :tangle (if (= 1 1) "yes") 2 #+end_src works just fine on main. I admit that I don't fully understand your use case. >> > -(defun org-babel-tangle--unbracketed-link (params) >> > +(defun org-babel-tangle--unbracketed-link (params &optional info-was-evaled) >> >> This is not acceptable. Taking care about evaluating INFO should be done >> in a single place instead of adding checks across the babel code. If we >> go the proposed way, I expect a number of bugs appearing when somebody >> forgets to change the eval check in some place. > > I don't like the solution either. I see two potential alternatives. > 1. change the structure of the info list to indicate whether it has > already been evaluated > 2. always call org-babel-read on (cdr (assq :tangle params)) even > if it may already have been evaluated which can lead to some unexpected > and potentially nasty results. I think that instead of repeating (cdr (assq :tangle params)) we need a common API that will abstract away evaluation and modify PARAMS by side effect if necessary. Something like (org-babel-get-heading-arg :tangle info/params) > I don't think we can consolidate evaluating parameters > into one place in the general case because there are > order dependencies where a setting in one param header > should mask others (as is the case here). May you please elaborate? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at