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 <yanta...@gmail.com> wrote:

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

Reply via email to