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
Date: Sat, 11 Jun 2022 20:49:40 +0800 [thread overview]
Message-ID: <87czffbc0r.fsf@localhost> (raw)
In-Reply-To: <CAHBUXNx2je2zvj2Zbn3yXx3FRqaiCjMghzQHQKWnAr5SLTZfYQ@mail.gmail.com>
Ryan Scott <ryan@vicarious-living.com> 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 ‘org-id-get-create’ is not known to
be defined.
ob-core.el:2787:58: Warning: the function ‘org-get-heading’ is not known to be
defined.
ob-core.el:2785:23: Warning: the function ‘org-id-get’ is not known to be
defined.
ob-core.el:2792:38: Warning: the function ‘org-attach-dir’ 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
> +<point>#+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
next prev parent reply other threads:[~2022-06-11 12:51 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 8:48 New source block results option for attaching file to node Ryan Scott
2021-08-31 11:15 ` Timothy
2021-08-31 19:43 ` Ryan Scott
2021-09-01 14:45 ` Ihor Radchenko
2021-09-01 20:01 ` Ryan Scott
2021-09-02 7:40 ` [PATCH] " Ryan Scott
2021-09-02 13:44 ` Greg Minshall
2021-09-03 3:10 ` Ihor Radchenko
2021-09-03 3:28 ` Ryan Scott
2021-09-05 13:22 ` Ihor Radchenko
2021-09-05 13:56 ` Ryan Scott
2021-09-10 1:04 ` Ryan Scott
2021-09-10 6:26 ` Timothy
2021-10-02 8:32 ` Ihor Radchenko
2021-10-02 9:39 ` Ryan Scott
2021-10-05 0:04 ` Christopher M. Miles
2021-10-05 1:05 ` Ryan Scott
2021-10-08 1:22 ` Christopher M. Miles
2021-11-05 7:16 ` Ryan Scott
2022-04-21 12:47 ` Ihor Radchenko
2022-04-21 17:29 ` Ryan Scott
2022-04-22 6:02 ` Ihor Radchenko
2022-04-22 6:19 ` Ryan Scott
2022-06-10 8:06 ` Ryan Scott
2022-06-11 4:32 ` Ihor Radchenko
2022-06-11 7:47 ` Ryan Scott
2022-06-11 12:49 ` Ihor Radchenko [this message]
2022-06-12 0:47 ` Ryan Scott
2022-06-14 4:11 ` Ihor Radchenko
2022-06-14 5:55 ` Ryan Scott
2022-06-14 9:04 ` Ryan Scott
2022-06-14 13:48 ` Ihor Radchenko
2022-06-14 18:23 ` Ryan Scott
2022-06-11 12:51 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87czffbc0r.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=minshall@umich.edu \
--cc=numbchild@gmail.com \
--cc=ryan@vicarious-living.com \
--cc=tecosaur@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).