From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
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 OL1HLMoapGIn7gAAbAwnHQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 11 Jun 2022 06:32:10 +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 eEI3LMoapGIrZAEA9RJhRA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 11 Jun 2022 06:32:10 +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 654E113774
	for <larch@yhetil.org>; Sat, 11 Jun 2022 06:32:10 +0200 (CEST)
Received: from localhost ([::1]:60138 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	id 1nzsnB-0007xy-Gq
	for larch@yhetil.org; Sat, 11 Jun 2022 00:32:09 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34542)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@gmail.com>)
 id 1nzsmV-0007xk-7L
 for emacs-orgmode@gnu.org; Sat, 11 Jun 2022 00:31:27 -0400
Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:42785)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <yantar92@gmail.com>)
 id 1nzsmT-0006zf-HB
 for emacs-orgmode@gnu.org; Sat, 11 Jun 2022 00:31:26 -0400
Received: by mail-pl1-x62b.google.com with SMTP id f8so827750plo.9
 for <emacs-orgmode@gnu.org>; Fri, 10 Jun 2022 21:31:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=WvKC2wMcTm2ePXs2PZVD7V0t3QY6sxv/INadFfp9ib8=;
 b=bUNam9wtt6yKq0vVXsVjDZbhNN3B6eDECiKDyGjg/v6Qd6plR8aNIRQTivHCq+7P7+
 a8TUiPnYOP8QvuTyBp4mKdsv7zsQ+Xyfl9xQlBORypWP/JAsAsHXFmmKYSlTdyHJ1nHs
 3fahMJR7pgks5tk+7taYhBeCZZVh3E4gdSjD6pt+vJSfWec7tALrq6DvQMHnUbxaQUG1
 WiI5/ZniDzROQziEWZgTsfQTuIdGmJ7acrvtZHXxgS5vtVcjvi8tVpB6A/EKO4eFPu9P
 c2fPT9bui41l/HYsSig8xGmBGlnDMyjZ8fjb0Xjpan98GSnm6eSjsDgnoKvOrDgrE4vq
 s5sg==
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:in-reply-to:references:date
 :message-id:mime-version;
 bh=WvKC2wMcTm2ePXs2PZVD7V0t3QY6sxv/INadFfp9ib8=;
 b=DWt4eWKejtARK6g9CKSv2KLKvyDEFxf6YrdJHD4j4cmiXSn0dXsz5AS90IZdHEUK+w
 MB8blgaU+zMkxQTlir6d4q87USZNHSuBtOJ53bwKcsx2zltJfykUDguu9gHocEq4u+S8
 y10O+FJRY8B5PVRoXt0jO3/n8rfz18+XldfwyaUa0CnaZfbg9Ql/DdbyF87Liym8n9Yo
 MEibx5o9i+14KuxG8QbyGyyOcWJpAw+1Czpax4UQjJ6HkjECX33baF7kIm/BxHx7NhwZ
 Jmefzts1Tq4AtQOPaxNhpdxwdrm0lhcYazjeFB3hkF89Nd5JJfVzlxuxmxgdKzPJNFtr
 sPhA==
X-Gm-Message-State: AOAM5339SUXkxjD0wsapUyUD6a/H9/QCb3tgdW8OYsvGUz9vRex0hKrS
 AFahQuHPR8S7YCufSAJU/HM=
X-Google-Smtp-Source: ABdhPJwl1sHPZvHrIo+nYxFgLUhuktowPT4aqV1VohntXZAV6ZAss3/gT0rajk0lCWp1IPiqpL9LfA==
X-Received: by 2002:a17:902:f641:b0:15f:21f8:92a1 with SMTP id
 m1-20020a170902f64100b0015f21f892a1mr49661287plg.56.1654921883694; 
 Fri, 10 Jun 2022 21:31:23 -0700 (PDT)
Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id
 i8-20020a17090a65c800b001e667f932cdsm2606215pjs.53.2022.06.10.21.31.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 10 Jun 2022 21:31:22 -0700 (PDT)
From: Ihor Radchenko <yantar92@gmail.com>
To: Ryan Scott <ryan@vicarious-living.com>
Cc: numbchild@gmail.com,  Greg Minshall <minshall@umich.edu>,  Timothy
 <tecosaur@gmail.com>,  emacs-orgmode@gnu.org
Subject: Re: [PATCH] Re: New source block results option for attaching file
 to node
In-Reply-To: <CAHBUXNzGWDbEttnRY_+i8NgbJs9BagYQ5D4G74w6=H398yEbeA@mail.gmail.com>
References: <981938.1630590273@apollo2.minshall.org> <87czpqjqvw.fsf@localhost>
 <PAXPR08MB6640CD9BF0636379CFA39084A3AF9@PAXPR08MB6640.eurprd08.prod.outlook.com>
 <CAHBUXNwySNh7Nwqk=A134DW+hjDjDZ3TSRTEb=F9L+bdcG=+Ag@mail.gmail.com>
 <CAHBUXNwOyU2rTazDcxc1AHgZsJx05+HfuwVJmBWbhg8brKSVQQ@mail.gmail.com>
 <87zgkey55y.fsf@localhost>
 <CAHBUXNyWVQk3e=9g3HgGWkiboHy5PbXXvBkoYTVDaygHg18tyg@mail.gmail.com>
 <8735i5u039.fsf@localhost>
 <CAHBUXNwj+cvSK_Su5BJmkXmvtkio7MVzvPRtO5NG0Cv6Mu_ijQ@mail.gmail.com>
 <CAHBUXNzGWDbEttnRY_+i8NgbJs9BagYQ5D4G74w6=H398yEbeA@mail.gmail.com>
Date: Sat, 11 Jun 2022 12:32:02 +0800
Message-ID: <87h74rq0ql.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::62b;
 envelope-from=yantar92@gmail.com; helo=mail-pl1-x62b.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, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, 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." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: "Emacs-orgmode" <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
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=1654921930;
	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=WvKC2wMcTm2ePXs2PZVD7V0t3QY6sxv/INadFfp9ib8=;
	b=ceOwOuOqpJ1slHQ8Y75CUrO+9SKL9HKpJguWL0lKtSWW7d2xo3AulmjUxF4Rf/JXaFl+Yp
	lMoONFJL9iCYE1KcvtGNQ/TRThGSysDQcMJn3ashuoicExshykl6iXh3IvPypGHYiGQF1I
	4KuCPO8ixWCFrgX3vtZowIunYCicKsXq4hmUEwYq8L5/TEs6Tdg9xksu4hIoMUBU6UzH7w
	edsVIEC9tgo2VGMJiNZeeyrfhA/HdfaDdpSqOwEXAnfruYjdl22X7quQfibwOQnwZBnYlm
	rPtiGr257bQLcJCe8m9Gvtu/c+8cKJa0Jd0/cNEPDDPfSlEKgK9tBt4SfGjuXg==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654921930; a=rsa-sha256; cv=none;
	b=I0HHIL56rodsmwUFq9bGC311OFmkhD+mMh3UKEPkHEijJTlrwFE3C8NHnJzzpVTBC/Aw6w
	7V8ovsYR2rR7syYX2WWnOuzqRp9vRij4VWu5tEAO64+ep1wZB/AXnTJc8BPktBsC5fJ8r0
	Z+lKQyoCyRhmSJDW2Q5S3Rg/AF77Szbino3yazpizQZeDY9nFFeCf3NJZTuXuUphTEg4bO
	0AZ8WOcrwPok2lMC8eQV4tvxlXp9kRuoALX7r3bcXBZLT7+k1eCNvUejMICxYKVk6NW9fT
	x1Fp4G4pQe5EAc+7xqQK/BsARlKUdCPG67r+rDSFD+RfL61vClJA4KKs5hajUA==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=bUNam9wt;
	dmarc=pass (policy=none) header.from=gmail.com;
	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.98
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=bUNam9wt;
	dmarc=pass (policy=none) header.from=gmail.com;
	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: 654E113774
X-Spam-Score: -6.98
X-Migadu-Scanner: scn0.migadu.com
X-TUID: Yp4qZ8ynP5Wq

Ryan Scott <ryan@vicarious-living.com> writes:

> I believe I have addressed your feedback, Ihor.
> Attached is the latest version of the patch.
>
>    - Merged latest master
>    - :post is now handled correctly (verified with example of :post usage
>    in the example at https://orgmode.org/manual/Results-of-Evaluation.html)
>    - Added "(with quotes)" to help make the NEWS entry clearer
>    - Changed the attach directory detection to use a string prefix check
>
> Let me know what you think.

Thanks for the updated patch!

> +          ((or '(:dir . attach) '(:dir . "'attach"))
> +           (unless (org-id-get)
> +             (if (or noninteractive (y-or-n-p (format "Create ID for entry \"%s\"?"
> +                                                      (org-get-heading t t t t))))
> +                 (org-id-get-create)
> +               (error "Can't attach to entry \"%s\". Entry has no ID"
> +                      (org-get-heading t t t t))))
> +           (setq params (append
> +                         `((:dir . ,(org-attach-dir nil t))
> +                           (:mkdirp . "yes"))
> +                         (assq-delete-all :dir (assq-delete-all :mkdir params)))))

Note that entry does not need :ID: property to have an attachment dir.
There is also :DIR: property.

Also, it would be useful to add a test. See test-ob-core/dir-mkdirp in
testing/lisp/test-ob.el

Best,
Ihor