emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] (org-babel-result-to-file) adds the relative path even if attachment link is generated [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]
@ 2022-12-03 23:54 Johan Tolö
  2022-12-06  7:11 ` Johan Tolö
  2022-12-07 11:16 ` Ihor Radchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Johan Tolö @ 2022-12-03 23:54 UTC (permalink / raw)
  To: emacs-orgmode



Remember to cover the basics, that is, what you expected to happen 
and
what in fact did happen.  You don't know how to make a good 
report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

With org 9.6 I am having an issue where the following generates a 
result with an attachment link that includes the original path to 
the file. I expect the link to be relative to the attachment 
directory.

* Test
:PROPERTIES:
:DIR:      build
:END:

#+begin_src R :results output file graphics :file build/test.png
  plot(1)
#+end_src

#+RESULTS:
[[attachment:build/test.png]]

The expected result is:

#+RESULTS:
[[attachment:test.png]]

My ob-core.el has in the org-babel-result-to-file function (on 
line 2712):

(file-relative-name result-file-name)

I changed it to:

(file-relative-name result-file-name attach-dir)

and got the expected result.


Johan

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ 
Version 3.24.35, cairo version 1.17.6)
 of 2022-12-01
Package: Org mode version 9.6 (release_9.6-3-ga4d38e @ 
/usr/share/emacs/30.0.50/lisp/org/)
-- 
Johan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] (org-babel-result-to-file) adds the relative path even if attachment link is generated [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]
  2022-12-03 23:54 [BUG] (org-babel-result-to-file) adds the relative path even if attachment link is generated [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)] Johan Tolö
@ 2022-12-06  7:11 ` Johan Tolö
  2022-12-07 11:16 ` Ihor Radchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Tolö @ 2022-12-06  7:11 UTC (permalink / raw)
  To: emacs-orgmode

Johan Tolö <johan@toloe.se> writes:
[snipped]
> * Test
> :PROPERTIES:
> :DIR:      build
> :END:
>
> #+begin_src R :results output file graphics :file build/test.png
>   plot(1)
> #+end_src
>
> #+RESULTS:
> [[attachment:build/test.png]]
>
> The expected result is:
>
> #+RESULTS:
> [[attachment:test.png]]
>
> My ob-core.el has in the org-babel-result-to-file function (on 
> line 2712):
>
> (file-relative-name result-file-name)
>
> I changed it to:
>
> (file-relative-name result-file-name attach-dir)
>
> and got the expected result.
[snipped]

Adding a elisp example that produces the same unwanted behaviour:

* Test
:PROPERTIES:
:DIR:      build
:END:

#+begin_src emacs-lisp :results value file
  "build/test.png"
#+end_src

#+RESULTS:
[[attachment:build/test.png]]



-- 
Johan Tolö


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] (org-babel-result-to-file) adds the relative path even if attachment link is generated [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]
  2022-12-03 23:54 [BUG] (org-babel-result-to-file) adds the relative path even if attachment link is generated [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)] Johan Tolö
  2022-12-06  7:11 ` Johan Tolö
@ 2022-12-07 11:16 ` Ihor Radchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2022-12-07 11:16 UTC (permalink / raw)
  To: Johan Tolö; +Cc: emacs-orgmode

Johan Tolö <johan@toloe.se> writes:

> With org 9.6 I am having an issue where the following generates a 
> result with an attachment link that includes the original path to 
> the file. I expect the link to be relative to the attachment 
> directory.
>
> * Test
> :PROPERTIES:
> :DIR:      build
> :END:
>
> #+begin_src R :results output file graphics :file build/test.png
>   plot(1)
> #+end_src
>
> #+RESULTS:
> [[attachment:build/test.png]]
>
> The expected result is:
>
> #+RESULTS:
> [[attachment:test.png]]
>
> My ob-core.el has in the org-babel-result-to-file function (on 
> line 2712):
>
> (file-relative-name result-file-name)
>
> I changed it to:
>
> (file-relative-name result-file-name attach-dir)

Thanks for reporting and catching the cause!
Fixed on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cc5427b7e

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-07 11:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-03 23:54 [BUG] (org-babel-result-to-file) adds the relative path even if attachment link is generated [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)] Johan Tolö
2022-12-06  7:11 ` Johan Tolö
2022-12-07 11:16 ` Ihor Radchenko

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).