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.

Let me know if there's anything about those tests that I should modify.

Thanks,
  -ryan

On Fri, Jun 10, 2022 at 9:31 PM Ihor Radchenko <yanta...@gmail.com> wrote:

> Ryan Scott <r...@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
>

Attachment: org-src-block-results-attach-dir.patch
Description: Binary data

Reply via email to