Yeah your second example is what I'm thinking. It makes this all a fairly concise extension of that existing mechanism and does away with the file move after execution. On Sun, Sep 5, 2021, 06:21 Ihor Radchenko wrote: > Ryan Scott writes: > > > It might make sense to fix up inserted "file:" links that are under the > > attachment directory to be "attachment:" style links by default anyway, > no? > > Then just being able to set the working directory to the attachment > > directory easily would get the rest of the way there. > > I am not sure. If the user explicitly states that :dir is the attachment > dir, it would make sense. However, what if the :dir is set explicitly > like below? > > * Headline > :PROPERTIES: > :DIR: /actual/literal/path/to/attachment/dir > :END: > > #+begin_src emacs-lisp :dir /actual/literal/path/to/attachment/dir > ... > > #+RESULTS: > attachment:... > > The results will be indeed inside the attachment directory. However, the > :DIR: property may be changed at some point and the existing attachment: > link will not point to real file. > > > So I suppose that would then mean having the :dir header accept the > symbol > > `attach' or something like that? > > I'll play around and see what that looks like. > > The above example should lead to more expected behaviour if the user > explicitly states that :dir is the attachment dir (even if it is going > to be changed in future): > > * Headline > :PROPERTIES: > :DIR: /actual/literal/path/to/attachment/dir > :END: > > #+begin_src emacs-lisp :dir 'attach > ... > > #+RESULTS: > attachment:... > > Best, > Ihor >