From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 2KpsC7ePpGLzNgEAbAwnHQ (envelope-from ) for ; Sat, 11 Jun 2022 14:51:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 6HhsCrePpGKX7wAAG6o9tA (envelope-from ) for ; Sat, 11 Jun 2022 14:51:03 +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 AEB7E32AF2 for ; Sat, 11 Jun 2022 14:51:02 +0200 (CEST) Received: from localhost ([::1]:56754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o00Zx-0008Dw-RJ for larch@yhetil.org; Sat, 11 Jun 2022 08:51:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o00Y8-0008Di-9l for emacs-orgmode@gnu.org; Sat, 11 Jun 2022 08:49:08 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:40450) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o00Y6-00011u-Ii for emacs-orgmode@gnu.org; Sat, 11 Jun 2022 08:49:08 -0400 Received: by mail-pl1-x632.google.com with SMTP id i1so1403015plg.7 for ; Sat, 11 Jun 2022 05:49:06 -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:content-transfer-encoding; bh=en0vg4VrzKdYi4UEqVS5K8EfoN9hnZfG6CgefKAWTXU=; b=ZDFUzINzBW/q6TV+B/AS7afI0HVhMv7owNW2gdmpwHtWvsuOhcTJ9n8R7qvANZhXL3 RN7GOnCrSgtw1fwykiPKaHZgBgGc4sBDi2bgVHFzlvdAZfr7MdImODarfciu05jrEqmb 5jOx3bAyf5gpip/XgsyVi65zuV66RnPJUrnAoaKQoE3xxC380WG/8WnayCw8P2rG4tTP vdqTFvzV8FU83zfBhEEAGnnyQGbobikQqaHPG9Q8JsJHi+BFeHTik3d4Lrqk+PQtJo9K qqTFxrUlWNWfRaeOTWWhR1GqYQtQ6+ALsqebeR/XwTHBsrgHSocAcQJpkKFNMSqPmALM Fz/Q== 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:content-transfer-encoding; bh=en0vg4VrzKdYi4UEqVS5K8EfoN9hnZfG6CgefKAWTXU=; b=YIK3ufWo6ZZdj5gRL/n+ZQHKsnW2NVquMIw+R9TA/ojvyf04ptpBWMsAgnpmddVz1X 6l8fEgQeKH7g0vNM5lxM6DoPPuEJY7yQfVDFZXJ1MVWLQB87b4+WJTvn89cz7/k2sJOv POhKODfMTrqWH/AcJh5LLbPeJyoE2ttdg2m7uKis+JE4ew5V9xX7pE67MYfJaFatM9DG sGlTmGFj/fUWjOw9/Y7RrP3pCta8zs9pDWDAmll7obybbJACh0bLl8nuxI3nkKPtfFZz rsBhCkt43xZfCv7CDcr+RGAYE7CWe41cZJHfI9ZKyByRkUR0fkPbk+jp6YSy5KBPcMLZ zjdQ== X-Gm-Message-State: AOAM530gjJ67kbTkueize+qeZxJkryUPx1YlFjfLwU8T3CHzgs81mp3h JVQeis1ZhDeYaQTYAZinfUE= X-Google-Smtp-Source: ABdhPJx69yHj55OBbGRljp239fHCzsg4KPW6KjfEWbfF5ZNNNm4JXsBNqznkB/GsQlmtnIhURelcGg== X-Received: by 2002:a17:902:6b89:b0:168:cf03:9e63 with SMTP id p9-20020a1709026b8900b00168cf039e63mr1229219plk.46.1654951745051; Sat, 11 Jun 2022 05:49:05 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id d15-20020aa797af000000b0051b930b7bbesm1474612pfq.135.2022.06.11.05.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jun 2022 05:49:04 -0700 (PDT) From: Ihor Radchenko To: Ryan Scott Cc: numbchild@gmail.com, Greg Minshall , Timothy , emacs-orgmode@gnu.org Subject: Re: [PATCH] Re: New source block results option for attaching file to node In-Reply-To: References: <981938.1630590273@apollo2.minshall.org> <87czpqjqvw.fsf@localhost> <87zgkey55y.fsf@localhost> <8735i5u039.fsf@localhost> <87h74rq0ql.fsf@localhost> Date: Sat, 11 Jun 2022 20:49:40 +0800 Message-ID: <87czffbc0r.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=yantar92@gmail.com; helo=mail-pl1-x632.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." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" 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=1654951862; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=en0vg4VrzKdYi4UEqVS5K8EfoN9hnZfG6CgefKAWTXU=; b=Pt3m1owpVeSINHpWj2JHz1m+OGvfTYZaOg2eiW/vttD7TkSmhM5zH2P39Qk/1zCUZ66OHp EeaIHEB5nmZIEAHhsNYTAumgxbqCUrwMv7ZcvSLvJN43YKmJfVxwkVew69qc+XAkuYId7y Aftcp31tAENTouJG1Ay+JAV+ca5qP6cARxJF8JW+qDcvUuU7nka/pM/fRawWEBDl5fBKWg RK6ifg4+03GCRaG+M08k/e57MRDEw++S9escg5eeP1IMSxVVOXvPKkxY7AsE1R42/iDn5A ilGxXDOTYO9f9rs6Lz5EzbpFPYMvvsAMA3SeNRUKrG7EXGLqHlquoOUJSW4oLw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654951862; a=rsa-sha256; cv=none; b=WPHm7eiEHaChFucblklXda9zVfG9ubzhrTF6yt6rBh33Ex9daavF+cXb2ILJdKfDkjcKyn Y0c0gy/QE2mSbVbKNlNM6FC9qwARPjr4nQQNtvM3DmgqsXo6ME3SUlMY4Ag9YSn3i9zTxi tajxUK+LLWThX9BmsKMPk56XluLUayY/P7rB/1ze2SVVuismoU7M8RBQtSmxf+QNXRuSeN ewuFO83NE+lBJlYY+0WhQT0F2erZijaunmKfsDXyE56dvynuGHrOCLapm+TjJKz5N6hfhP weeZlON3piV5k/iehxvHweWmtp+Qt4vKeJvA3lU8pdT0gUytIsK0S12WDP0WYQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ZDFUzINz; 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: -3.48 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ZDFUzINz; 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: AEB7E32AF2 X-Spam-Score: -3.48 X-Migadu-Scanner: scn1.migadu.com X-TUID: cwflmPmZ9VnU Ryan Scott writes: > Had no experience with the :DIR: property or writing unit tests for Org, > but I think I've got both covered now. > The ID creation prompting now only happens if there is no result from > org-attach-dir, which should address the :DIR: case. Thanks! > Let me know if there's anything about those tests that I should modify. Yeah. They do not pass, currently... You can try yourself by running make test from Org git directory. >> > + ((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)))) Unconditional ID creation for noninteractive is a bad idea. It is safer to throw an error. This code also generates warnings: In end of data: ob-core.el:2788:21: Warning: the function =E2=80=98org-id-get-create=E2=80= =99 is not known to be defined. ob-core.el:2787:58: Warning: the function =E2=80=98org-get-heading=E2=80=99= is not known to be defined. ob-core.el:2785:23: Warning: the function =E2=80=98org-id-get=E2=80=99 is n= ot known to be defined. ob-core.el:2792:38: Warning: the function =E2=80=98org-attach-dir=E2=80=99 = is not known to be defined. Note that not all the ideas use org-id. Hence, `org-id-get-create' may not be available during runtime. Adding (require 'org-id) is not a good idea either (there will be other side-effects). So, if org-id is not loaded, it will be better to just throw an error. > +(ert-deftest test-ob-core/dir-attach () > + "Test :dir header using special 'attach value" > + (should > + (org-test-with-temp-text-in-file > + "* Symbol > +#+begin_src elisp :dir 'attach :results file > +(f-write-text \"attachment testing\" 'utf-8 \"test.txt\") f-write-text requires f.el, which is external packages. You cannot use it. Also, while you are here, you can as well add tests for other possible :dir settings. Best, Ihor