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 uC2mFDEpWGHrlQAAgWs5BA (envelope-from ) for ; Sat, 02 Oct 2021 11:41:05 +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 kBtTEDEpWGFICAAAB5/wlQ (envelope-from ) for ; Sat, 02 Oct 2021 09:41:05 +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 CB2152CFF1 for ; Sat, 2 Oct 2021 11:41:04 +0200 (CEST) Received: from localhost ([::1]:50528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWbVv-0003Tr-3g for larch@yhetil.org; Sat, 02 Oct 2021 05:41:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWbUd-0003Tj-8g for emacs-orgmode@gnu.org; Sat, 02 Oct 2021 05:39:43 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:33340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWbUb-0006dR-7c for emacs-orgmode@gnu.org; Sat, 02 Oct 2021 05:39:43 -0400 Received: by mail-wm1-x32b.google.com with SMTP id q17-20020a7bce91000000b0030d4e298215so2335821wmj.0 for ; Sat, 02 Oct 2021 02:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vicarious-living-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JBVyCe1R3d6IYWJslSuLpLPus3Rg3b92iJrkcEEucCM=; b=2M9e2c4IJxX+4yH/oyQoLZaVOa80gBLNZY1OfzSIfAhpKvpYgDGT+7OYp/tYAAylGu TNsXrxZqCDwh1HPGvGREp8whxQ/yzGLAGkYOfOAPSt1B1sry1AvrH8xnDzV1wP9tQ3HQ qLTfIzGWyQ5cE87tyuMlTf30r0mc3SQACRP/EEKfo9keQUIl/v5bAaTjBCBeiiOiv/OQ KFoQ2qKJ+SiZDl0HaN+GVAsuUoiAGLmlbWDqsrd/XitNU7vzgBE9tGXYBBMNk7B9or+D frQfITqjtmvBFtNb6Z5DqINVoi6niplTC9N5ru/Kc4mz13wTXX/rZ9kYndxVgBzPlCFG 04xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JBVyCe1R3d6IYWJslSuLpLPus3Rg3b92iJrkcEEucCM=; b=gSM0db52dUzVdqnG+LEIoDyltiYat/lAD7dUESjIaCZZRYsMueJdUoglv4XhFYLbnf Sl1Rg85c2Up1ZRsg+P4ckoOS/legpa7x6lBI1XYsjLADM/0BhbV1gwm4URqksHWt1cWz kywajOvirctkUH8BoGb3eoL0iioLlE6BgtUuUHOAlL3FTLYBmjVw5ScMJlxlTGHU1yJv Mq73ZKuHqZlyxdNuEq+M5nnjbVqyfnWY75Xe0L5H9h9WhFqnotHQz0cH0wLeZyR6x2ae JzFfP6EwN2YqnORgc0TD3DZaBsPYhr8Pd/CYW8S8sBUSAh2NNERjnYfdENMldQ0+TPVU 3apg== X-Gm-Message-State: AOAM532PL8+ZhaLrcLsJ+5bWoaBtGuYBJWFRh0IHsaN9x+7L6sujIOaD JN6czPxRwzqtI3qhZPQbj+hrFHFXfCMcMYlc6h6DKQ== X-Google-Smtp-Source: ABdhPJzXl2J0wBVxyTxzFNoThLa9jUKZRCu4u1xVVhwr9lPEF4a0Z+oF/EVHLZzFUrIepw/dcGte1ReK19Bq8vFg1Qs= X-Received: by 2002:a05:600c:4a16:: with SMTP id c22mr8783803wmp.72.1633167578868; Sat, 02 Oct 2021 02:39:38 -0700 (PDT) MIME-Version: 1.0 References: <981938.1630590273@apollo2.minshall.org> <87czpqjqvw.fsf@localhost> <877dfvw41u.fsf@localhost> <87k0ivygga.fsf@localhost> In-Reply-To: <87k0ivygga.fsf@localhost> From: Ryan Scott Date: Sat, 2 Oct 2021 02:39:27 -0700 Message-ID: Subject: Re: [PATCH] Re: New source block results option for attaching file to node To: Ihor Radchenko Content-Type: multipart/alternative; boundary="00000000000065c24b05cd5b7506" Received-SPF: none client-ip=2a00:1450:4864:20::32b; envelope-from=ryan@vicarious-living.com; helo=mail-wm1-x32b.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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, Timothy 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=1633167665; 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=JBVyCe1R3d6IYWJslSuLpLPus3Rg3b92iJrkcEEucCM=; b=lSZtUHqSnhSFcuXkDGGRXmXwGcrMXs/0LlV0so7BV6wTD89MqR1L/8/kGiNiNPB3pu2G+D ltGm1xkwsnRyAz8BrkaoXBaI3m6l6nJMoOnEyNN8ywZlFGnkQ7Sucz6BdSRySvkWt2Uma2 2/w0AKXPaKnGIW6Au1PbpsbCzXZBtloP1AG6me3LezFq7c6gvItGrWQHXq0QoANnRCXzRq yNEL4qGXsER5uieMxBwJq6M5WXuvIsMFh2vcGDe15KKfqeyEjkcs21QkghQApZ5b/LKyeo wlw3vt8jnj9oIJNmeoeF84wqQLHUfKR1MiPTRSrkY/mv2GsezSGL0PNocsEpXw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633167665; a=rsa-sha256; cv=none; b=qzKsUR5JAL/DpM7UbQSB/OdrwlcTpNbWEotdP4NfdqNPo1eIAGuyL6KrjTV2Oo1/2PjDL+ p+VrRl6seFXO070zVd2ijtOPEzNu4D3cqul80X12+3QWHu0j2UfRYrgoAJfoAJtB3vLij6 C0xZzg+627YLymXiDelB2aQY0MxigTCzv5yoLSMJqher7oFbiSbAPHrMevc3oq8thmHbiJ ngHOYDlESJzsv6UUlq1tTbFi4nVFX0iAXYIQ+sqX6eRNejshvXPQI6hdCIsCbZliGyfEm8 7Kd/FkATczl8DsgcEMGZkmZ/g4Zo2Hm5BDCVpainJZwTnMPJCnzUzETtGJdHBg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=vicarious-living-com.20210112.gappssmtp.com header.s=20210112 header.b=2M9e2c4I; dmarc=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: -2.01 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=vicarious-living-com.20210112.gappssmtp.com header.s=20210112 header.b=2M9e2c4I; dmarc=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: CB2152CFF1 X-Spam-Score: -2.01 X-Migadu-Scanner: scn1.migadu.com X-TUID: 2s4hINxc4TSQ --00000000000065c24b05cd5b7506 Content-Type: text/plain; charset="UTF-8" Would it be better then as a new option entirely that sets the default directory to the attachment directory and results in attachment links for any inserted paths that are under that? The attachment link detection could possibly be default behavior for link insertion, but i can imagine that might have broader implications. I also found and have a fix for my patch where the 'attach symbol gets converted to a string when using #+call to call a block that is defined with this option, which felt a little awkward in the code. I'll try this as a standalone option and see how that feels. That would carve out space for other options in handling attachments. On Sat, Oct 2, 2021, 01:31 Ihor Radchenko wrote: > Ryan Scott writes: > > > (default-directory > > - (or (and dir (file-name-as-directory dir)) default-directory)) > > + (or (and dir (if (eq dir 'attach) > > + (org-attach-dir t) > > + (file-name-as-directory dir))) > > + default-directory)) > > This does not always work. Some ob-*.el code (namely, ob-lisp have the > following: > > (let ((dir (if (assq :dir params) > (cdr (assq :dir params)) > default-directory))) > > As you can see, :dir parameter is overriding default-directory. If :dir > is set to symbol 'attach, execution will fail. > > I think that you also need to override :dir in the parameter list and > put actual path to attachment dir instead of symbol. That way, we will > not need to change every possible ob-*.el implementation to account for > new 'attach option. > > Also, marking this as patch. > > Best, > Ihor > --00000000000065c24b05cd5b7506 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Would it be better then as a new option entirely that set= s the default directory to the attachment directory and results in attachme= nt links for any inserted paths that are under that?

<= /div>
The attachment link detection could possibly be defa= ult behavior for link insertion, but i can imagine that might have broader = implications.=C2=A0

I al= so found and have a fix for my patch where the 'attach symbol gets conv= erted to a string when using #+call to call a block that is defined with th= is option, which felt a little awkward in the code.=C2=A0

I'll try this as a standalone option = and see how that feels. That would carve out space for other options in han= dling attachments.=C2=A0

On Sat, Oct 2, 2021, 01:31 Ihor Radchenko <= ;yantar92@gmail.com> wrote:
Ryan Scott <ryan@vicarious-= living.com> writes:

>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (default-directory
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 (or (and dir (file-name-as-directory dir)= ) default-directory))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (or (and dir (if (eq dir 'attach)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-attach-dir t)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 (file-name-as-directory dir)))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0default-direct= ory))

This does not always work.=C2=A0 Some ob-*.el code (namely, ob-lisp have th= e
following:

(let ((dir (if (assq :dir params)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cdr (assq :dir para= ms))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 default-directory)))

As you can see, :dir parameter is overriding default-directory.=C2=A0 If :d= ir
is set to symbol 'attach, execution will fail.

I think that you also need to override :dir in the parameter list and
put actual path to attachment dir instead of symbol.=C2=A0 That way, we wil= l
not need to change every possible ob-*.el implementation to account for
new 'attach option.

Also, marking this as patch.

Best,
Ihor
--00000000000065c24b05cd5b7506--