From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UMBcEPXBU2FNxAAAgWs5BA (envelope-from ) for ; Wed, 29 Sep 2021 03:31:33 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8LLnC/XBU2F0MwAAbx9fmQ (envelope-from ) for ; Wed, 29 Sep 2021 01:31:33 +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 770EF1BDAC for ; Wed, 29 Sep 2021 03:31:32 +0200 (CEST) Received: from localhost ([::1]:53554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVORX-0003VX-H7 for larch@yhetil.org; Tue, 28 Sep 2021 21:31:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVOQh-0003VJ-3Q for emacs-orgmode@gnu.org; Tue, 28 Sep 2021 21:30:39 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:45778) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVOQf-0002PY-B2; Tue, 28 Sep 2021 21:30:38 -0400 Received: by mail-pf1-x42b.google.com with SMTP id w19so530885pfn.12; Tue, 28 Sep 2021 18:30:36 -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=o+U6VSFF+y8Uyp+R3UdBjKMrOQGHgk6pMLMeWhol/VM=; b=bNd53UN4+f9ZFalhjk8sgq1N30Vn3STx4aO4nx2faTYo4m/AC7CPosTA6Po6vy2m8S n1czFJzELd4VNEyJm/yzpdM+qtVFlxb+I1X7N0sJZ/SFfrsLBLvYAV3NyNjvWyzX/IUs OvDFdZw8DwB5sMIGcZCP2j2aIdkt/USC9Oqqmtb7eXejzy+esObf1e6fDUx5wBxGXBMz nFAhBPaKmiFz0D+yYpi4YQdSiIMEf2yZmTGl2XeTqchVoC9GgvMkjTKA7vbxAZxBgBht tTM/99fzuPxPBVikxXOps06dQZ/6GYDYz51rqU37dugMh/+xsME/FSZ1ZgMgITupoCID +VfQ== 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=o+U6VSFF+y8Uyp+R3UdBjKMrOQGHgk6pMLMeWhol/VM=; b=dVf5b63zKjTspFIXGEZ3ma4143Bvosd+/PqVjU0PBbQ/Lya+42unExN10s4VffDy3g FURM/29fpd7Zl1oogni/PejnlG84GyWxNyVkkc3CBfYPiZgsauX8WLJoODDwid8NOH9B HPruHbUrnleE9Ul2kazpCsG/LBO223AgkGcHzrpmPy9IYFhiwuzQM1OsUQ6bORS5aGmK z4arydFkB7ldbvByXGNmiALZrRvz8n9voQgsW4WacqFP8iTLAFjH8r3yejnulRwu469B 8tZFbDzu3bnTfMrU+jZcRtdl+Fz6wf05IAMrrjeWR7a39bffcn2Ws/cSu45PWHQrCpD8 Wq6Q== X-Gm-Message-State: AOAM532icQ9w9VQMOiG/1Ffc5DOhjbchXl6QbT0gFde4Ci8NJB6aH3t1 paJ4WqfeVACphjXnVGhIhBlNZf4QZuc= X-Google-Smtp-Source: ABdhPJzGgJQH8nuFhyxiaDZk80ufxktW2Izp4UdUk/261I06e25McjSzm66QRyRI72UV/LPZJsIrqQ== X-Received: by 2002:a63:6e48:: with SMTP id j69mr7324934pgc.460.1632879034762; Tue, 28 Sep 2021 18:30:34 -0700 (PDT) Received: from ryzen3950 (c-73-170-21-48.hsd1.ca.comcast.net. [73.170.21.48]) by smtp.gmail.com with ESMTPSA id n18sm327001pfa.42.2021.09.28.18.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 18:30:33 -0700 (PDT) From: Matt Huszagh To: Bastien Subject: Re: babel default header args as functions In-Reply-To: <87sfxomd31.fsf@gmail.com> References: <87ftflikkc.fsf@gmail.com> <871rjqprdu.fsf@gmail.com> <875z8wxis3.fsf@gmail.com> <8735preoti.fsf@bzg.fr> <87sfxomd31.fsf@gmail.com> Date: Tue, 28 Sep 2021 18:30:32 -0700 Message-ID: <87pmssmamf.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=huszaghmatt@gmail.com; helo=mail-pf1-x42b.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Cc: , "emacs-orgmode@gnu.org" 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=1632879092; 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=o+U6VSFF+y8Uyp+R3UdBjKMrOQGHgk6pMLMeWhol/VM=; b=G4CxZRONMHnDsjC987yz/Sz7XQAphSW3zLArNyTRmADNdIHGO1WSDtx9v6WZoSIrHGCN6a hd3jVisQkbiDfsrpt8HSAGgtyJ+9kGh3ZD3c68zeQ9nQdCzeWwZ5CZwlwJCSLFyy3gt8vb 35sqRHfKZkDcFEfLp/eaqqIsYgWDxyggDt292uzMoK22DYeS0z+MaaFZEZO9egJX80u5rD f7EmUT+kEWzc3AuUY2PaQ9xt4q7Q442YZgg3IZMsP3AfkEyizPVzfvnj2DiNRv1Qy+AioP LxgXNu3oYQl3EU/b6LWE0oZI5BLyox/5Is1Dl5zzHKEpXIn/5E6KzNXAgIkWZA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632879092; a=rsa-sha256; cv=none; b=ul8md0DPzzfqxFznqfbTAfNHn9//hflA+bzlYcrQ7bs5GLU8ICQsyEJ0+/bnZ31URRCisU s9b9QBh7EGZjfyvNiWOniEckdhNY8z2YfN9byRHcp924L/00dqVCR5ZrgU6+FBOAlav91X MB6V3/rdE4Ntjql2pwK7vDoRXnKfWnnpWamD/YFQdUGArFQwANKN6XK3uJuoE7Ci/Rvwh9 MB/Ogb1jQ4tFBUYnKrKfG4kYBzdxxIF4mrki69Y5jZOwmCAzvK4YQMojWkZiHwdm91r9Eh 04+pep414Misha2SJmy6BkBXSCLhgqaBSXE1rXdU030vcaXEJ6Ou27RMH2LtHA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=bNd53UN4; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: -1.30 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=bNd53UN4; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: 770EF1BDAC X-Spam-Score: -1.30 X-Migadu-Scanner: scn0.migadu.com X-TUID: j9jP5Ik5vwoi --=-=-= Content-Type: text/plain Matt Huszagh writes: > Thanks Bastien, and no worries about the delay. However, I hate to say > it but I think you may have applied an old patch. The most recent patch > is > > https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/txtzi_PffIaG1.txt > > Let me know what I can do. I've tested it, and if you revert 78783f4e47901255695031dae0efcbb301a40878 and apply the new patch, it will apply with conflicts. Let me know if you run into any difficulties, have any concerns, etc. >> It deserves an entry in etc/ORG-NEWS for Org 9.5, would you be willing >> to submit a patch for this? > > Yep, I'll send one over. Here's the patch for the news item. Bear in mind that the last part about lazy evaluation is only true for the newest patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-etc-ORG-NEWS-Add-news-item-about-org-babel-default-h.patch Content-Description: ORG-NEWS patch >From ae721d089854e3b6b2d71ab6829b0cace25f0968 Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Tue, 28 Sep 2021 18:26:04 -0700 Subject: [PATCH] etc/ORG-NEWS: Add news item about org-babel-default-header-args accepting closures --- etc/ORG-NEWS | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index b0a893946..db6df83f2 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -151,7 +151,7 @@ enable Calc units simplification mode. *** Support fontification of inline export snippets -Inline +Inline See [[msg:87im57fh8j.fsf@gmail.com][this thread]]. @@ -443,6 +443,33 @@ See [[msg:875z8njaol.fsf@protesilaos.com][this thread]]. attachment directory at calls of ~org-attach-sync~. There is Never delete, Always delete and Query the user (default). +*** ~org-babel-default-header-args~ can now be specified as closures or strings + +~org-babel-default-header-args~ now also accepts closures that +evaluate to a string. Previously, only direct strings were +supported. These closures are evaluated when point is at the source +block, which allows them to make use of contextual information at the +relevant source block. One example that illustrates the usefulness of +this addition (also given in the documentation for +~org-babel-default-header-args~) is: + +#+begin_src elisp +(defun org-src-sha () + (let ((elem (org-element-at-point))) + (concat (sha1 (org-element-property :value elem)) \".svg\"))) + +(setq org-babel-default-header-args:latex + `((:results . \"file link replace\") + (:file . (lambda () (org-src-sha))))) +#+end_src + +This will set the ~:file~ header argument to the sha1 checksum of the +contents of the current latex source block. + +Finally, the closures are only evaluated if they're not overridden for +a source block. This improves efficiency in cases where the result of +a compute-expensive closure would otherwise be discarded. + ** Miscellaneous *** =org-bibtex= includes =doi= and =url= entries when exporting to BiBTeX =doi= and =url= entries have been made optional for some publication -- 2.31.1 --=-=-= Content-Type: text/plain Matt --=-=-=--