From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id fLCYOC77OmFQqAAAgWs5BA (envelope-from ) for ; Fri, 10 Sep 2021 08:29:02 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qHHpMy77OmHXHgAAB5/wlQ (envelope-from ) for ; Fri, 10 Sep 2021 06:29:02 +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 41C249F3 for ; Fri, 10 Sep 2021 08:29:02 +0200 (CEST) Received: from localhost ([::1]:60938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOa20-0003ND-Uo for larch@yhetil.org; Fri, 10 Sep 2021 02:29:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOa13-0003Ms-Af for emacs-orgmode@gnu.org; Fri, 10 Sep 2021 02:28:01 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:41775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mOa0x-00041l-15 for emacs-orgmode@gnu.org; Fri, 10 Sep 2021 02:28:00 -0400 Received: by mail-pg1-x52c.google.com with SMTP id k24so920800pgh.8 for ; Thu, 09 Sep 2021 23:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:references:user-agent:in-reply-to :message-id:mime-version; bh=4GTHCt367e0GkrJYTK1XLCEzUTzWTulwdlQTvjE7oG8=; b=Ya951F/vvHUbPjPU+qcoADT0hnX4Xsl+3eKgGweqTLwj6HWMJGUwcuj1lNZOkvc4zv DpvgMqFGpOf3p6SKVdnYG0tYAgs4OMXQ8X7lx1C5pgMHagRoGGRmdm9BSpbZrIwwtIDh HDxrdCKYZbgIwb74IXjpT/4ZYuiClFYM/xEMnmJH3IOAk1/ekG/rG+O0KuyrVv0bCsrq GLXsgp2HMLtDl3YVcAKXfjtW8UcyXlBwdUoxbTcaIyj8FomOEpvXx3f66xHb4vgLx367 wYQJ9TPNrdczjwLIfT094BsyPc9IehZm0VZVHomLWdUTw5R+Ti4zn2MQV4R4lyW82OzF yU5w== 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:subject:date:references:user-agent :in-reply-to:message-id:mime-version; bh=4GTHCt367e0GkrJYTK1XLCEzUTzWTulwdlQTvjE7oG8=; b=AdrVV0u2L86bh3uX029XqlpaXwN0Px98Xal8ihR2Jb3KpdEwdNXSjQ1pDyBAtt4pEN vWfF25RwCPKHgvl9eFbLPKiThAKCG+McDa5TlsdvBGbgCRkGXyQ1f0GDOy7XvAhYJ+OL Cj6rwt4kaYQHJYQizDlybktEBCTsd24/k2wzT+npimSHqdh3rvuDhT15eaB81kl8nRLT 4HGoX+xq4DVxsfe4XJ+nyBubzJRZx4vGXLh1AX9CQcVmLH6SK42QbaCgAxM23EfxsG6p aDwFCDrbrUeHStrCMW+X6TjCHrBcrQqC1mKs7by39XU1N6RyjirqdgDgJjz+GgF5x7Y3 QcsQ== X-Gm-Message-State: AOAM5315M8bGkVWFAtC59wLkNR3iG+Ubp/bmqyYttoV1BTFNnX+u8X8f FMlBmcrWhnOFtzsbllaPRNI= X-Google-Smtp-Source: ABdhPJxV8+hB8g1ufooJCGYzKnXIu6VqCPiyegq7GpFOX4iQvlVnxTiYiPcY989idyUiP03adhXVYQ== X-Received: by 2002:a63:df0d:: with SMTP id u13mr6020099pgg.417.1631255272927; Thu, 09 Sep 2021 23:27:52 -0700 (PDT) Received: from localhost (61-245-128-160.3df580.per.nbn.aussiebb.net. [61.245.128.160]) by smtp.gmail.com with ESMTPSA id u35sm468669pfg.156.2021.09.09.23.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 23:27:52 -0700 (PDT) From: Timothy To: Ryan Scott Subject: Re: [PATCH] Re: New source block results option for attaching file to node Date: Fri, 10 Sep 2021 14:26:21 +0800 References: <981938.1630590273@apollo2.minshall.org> <87czpqjqvw.fsf@localhost> <877dfvw41u.fsf@localhost> User-agent: mu4e 1.6.5; emacs 28.0.50 In-reply-to: Message-ID: <87wnnpc5cq.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=tecosaur@gmail.com; helo=mail-pg1-x52c.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, HTML_MESSAGE=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: , Cc: Greg Minshall , emacs-orgmode@gnu.org, Ihor Radchenko 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=1631255342; 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=4GTHCt367e0GkrJYTK1XLCEzUTzWTulwdlQTvjE7oG8=; b=PxuwyDlPGpf5XbX3LOSwLYghBXl4Vv+4PsS94RaIhroIs1R9p4H/O5sIXaszG9AGwN91zB 41NMfRsQh+lWPaao97loYhr0CrCzceEIzu9arj0YL6q5v7fi0AaXnn5liUcotoEo1zM1vB QUeRD0Rqh/kovg7QrGsxKThZ6Bg0mNYK2Lus9zkriXkh33mqLWqyrbUqndhBaw+zbTkQf0 d6SLpgGNQ4lWhXRvDjwHfiwGPRGy6lQxTeiJAPmuOHo8z5Wd8ltLiKF5s3U4wgtrhgych/ LgQTgwcYwpiLoHbXcHIx+Ml8H5zG7vQHnY9uJNZoY591YZnO44oMiEh26dICcw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631255342; a=rsa-sha256; cv=none; b=STX2XU/u8jlRotVNpcJsEQV2kCNJx5/2a+qxsCY4ofm0qX94tX84z2eyh50S7WSjCLKB6O eTI2EPiu0p70Y7vQPyuEzf8YHJvi7Ig/9wKzr12H4x1ecZ89Ryr1YY+piZjh4Cjy40UPq3 lF/UOKCiylB8BGUi9IJCbtrC7SMPZVGVXYbUwYmf7sKAZSgCUW9ZTxC626UncC8xmWn/BV BbEj7hD4z0RF5ZK2ftynnloCSsKzVsUnsl92+qjEDlp6EMGXdHJfek2uea4rVHzE1nbRk4 PAcUPY6SGbUzcUYQ4Jsszp+dY6hUuDcbCvb5j6eQYszQAXrntxiN0YfmukWwpw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="Ya951F/v"; 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: 0.41 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="Ya951F/v"; 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: 41C249F3 X-Spam-Score: 0.41 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0jTF2vf2TRgr --=-=-= Content-Type: multipart/alternative; boundary="==-=-=" --==-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ryan, I=E2=80=99ve just had a glance, but this looks much better to me than what = was proposed earlier =F0=9F=91=8D. Hopefully we=E2=80=99ll be able to get some feedback = on this from others, and then see it merged =F0=9F=99=82. All the best, Timothy --==-=-= Content-Type: text/html; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable

Hi Ryan,

I=E2=80=99ve just had a glance, but this looks much better to me than what = was proposed earlier =F0=9F=91=8D. Hopefully we=E2=80=99ll be able to get some feedback = on this from others, and then see it merged =F0=9F=99=82.

All the best,
Timothy

From: Ryan S= cott
Subject: Re: [PATCH] Re: New source block results option for attaching = file to node
To: Ihor Radc= henko
Cc: Greg Minsh= all, emacs-orgmode@gnu.org,

The short version is that speci= fying ":dir 'attach" for a block uses the directory from (org-att= ach-dir) as its working directory and any generated path that is a descenda= nt of that directory will be converted to an "attachment:" link.<= /div>

ob-core.el/babel: Special handling for attachment= links in src blocks

* ob-core.el (org-babel= -execute-src-block): Specifying the symbol
'attach` as the value of the= `:dir' header now functions as
":dir (org-attach-dir)"
(= org-babel-result-to-file): Optional `TYPE' argument accepts symbol
'att= achment` to fixup up paths under `DEFAULT-DIRECTORY' and use the
link t= ype "attachment:" when that is detected.
(org-babel-insert-re= sult): Pass symbol `attachment' as `TYPE' to
`org-babel-result-to-file'= when header `:dir' is set to symbol
`attach'
(org-babel-load-in-se= ssion, org-babel-initiate-session) ":dir 'attach"
sets `defau= lt-directory' with "(org-attach-dir t)"
* org-attach.el (org-= attach-dir): Added autoload header to simplify
dependencies necessary t= o support this feature (called in
`org-babel-execute-src-block').
<= /div>

Yeah your= second example is what I'm thinking. It makes this all a fairly concise ex= tension of that existing mechanism and does away with the file move after e= xecution. 

On Sun, Sep 5, 2021, 06:21 Ihor Radchenko <yantar92@gmail.com> wrote= :
Ryan Scott &l= t;ryan@vicarious-living.com> writes:

> It might make sense to fix up inserted "file:" links that ar= e under the
> attachment directory to be "attachment:" style links by defa= ult anyway, no?
> Then just being able to set the working directory to the attachment > directory easily would get the rest of the way there.

I am not sure. If the user explicitly states that :dir is the attachment dir, it would make sense. However, what if the :dir is set explicitly
like below?

* Headline
:PROPERTIES:
:DIR: /actual/literal/path/to/attachment/dir
:END:

#+begin_src emacs-lisp :dir /actual/literal/path/to/attachment/dir
...

#+RESULTS:
attachment:...

The results will be indeed inside the attachment directory. However, the :DIR: property may be changed at some point and the existing attachment: link will not point to real file.

> So I suppose that would then mean having the :dir header accept the sy= mbol
> `attach' or something like that?
> I'll play around and see what that looks like.

The above example should lead to more expected behaviour if the user
explicitly states that :dir is the attachment dir (even if it is going
to be changed in future):

* Headline
:PROPERTIES:
:DIR: /actual/literal/path/to/attachment/dir
:END:

#+begin_src emacs-lisp :dir 'attach
...

#+RESULTS:
attachment:...

Best,
Ihor
--==-=-=-- --=-=-=--