emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)]
@ 2024-06-25 10:57 Sam Crawford
  2024-06-26 13:23 ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Crawford @ 2024-06-25 10:57 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

When running an R session for org babel, if the working directory of
that session is different to the directory of the org file, then source
blocks with :results (output) graphics file will not work correctly. I
believe this is due to the fact that
org-babel-R-construct-graphics-device-call uses a relative filename.

I'm not sure what the best way to fix this is. My workaround was to
replace out-file with (file-name-concat default-directory out-file) in
the call to format at the end of 
org-babel-R-construct-graphics-device-call, but I'm not convinced this
is the best way to do things.


Emacs : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.42, cairo version 1.18.0)
of 2024-06-21
Package: Org mode version 9.8-pre (release_9.7.4-80-g7fa169 @ /var/home/sam/.emacs.d/straight/build/org/)


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

* Re: [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)]
  2024-06-25 10:57 [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)] Sam Crawford
@ 2024-06-26 13:23 ` Ihor Radchenko
       [not found]   ` <Eol9qrqro63gxtIvCHknY775AV2QB4sVptOEZY__3tyWRRgw7GkCfbxqahcbQoVgNoQeqJzzXs5fHS-7ocn3OqTE0hJSwW9HCmWF4lt6N6g=@crawf.uk>
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2024-06-26 13:23 UTC (permalink / raw)
  To: Sam Crawford; +Cc: emacs-orgmode@gnu.org

Sam Crawford <sam@crawf.uk> writes:

> When running an R session for org babel, if the working directory of
> that session is different to the directory of the org file, then source
> blocks with :results (output) graphics file will not work correctly. I
> believe this is due to the fact that
> org-babel-R-construct-graphics-device-call uses a relative filename.

May you please create a reproducer?

-- 
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] 6+ messages in thread

* [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? (was: [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)])
       [not found]   ` <Eol9qrqro63gxtIvCHknY775AV2QB4sVptOEZY__3tyWRRgw7GkCfbxqahcbQoVgNoQeqJzzXs5fHS-7ocn3OqTE0hJSwW9HCmWF4lt6N6g=@crawf.uk>
@ 2024-06-27  9:41     ` Ihor Radchenko
  2024-06-28 12:47       ` Rudolf Adamkovič
  2024-06-28 15:09       ` [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? Suhail Singh
  0 siblings, 2 replies; 6+ messages in thread
From: Ihor Radchenko @ 2024-06-27  9:41 UTC (permalink / raw)
  To: Sam Crawford; +Cc: emacs-orgmode

[ Adding Org mailing list back to CC to keep the conversation public ]

Sam Crawford <sam@crawf.uk> writes:

>>  May you please create a reproducer?
>
> Sure: evaluating the following code cell
>
> #+begin_src R :session R :async yes :results file graphics :file test.png
>   plot(iris$Sepal.Length, iris$Sepal.Width)
> #+end_src
>
> will call run-ess-r, which gives a prompt asking for the "R starting directory". Selecting any directory other than the directory the org file is located in will cause the issue.

I can reproduce, but I am not sure if this is something we are supposed
to fix.

The Org mode manual says the following about :dir header argument in
code blocks:

    The ‘dir’ header argument specifies the default directory during code
    block execution.  If it is absent, then the directory associated with
    the current buffer is used.
    ...
       When ‘dir’ is used with ‘session’, Org sets the starting directory
    for a new session.  But Org does not alter the directory of an already
    existing session.

ob-R currently does not obey what the manual says, and, when :dir is
omitted, allows the session directory to be set via prompt rather than
keeping the Org buffer's directory.

I'd like to hear from ob-R/ob-julia users whether the current behavior
is something they rely on. If not, I'd prefer to follow the conventions
we introduce in the manual and suppress the ESS's directory prompt.

-- 
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] 6+ messages in thread

* Re: [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? (was: [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)])
  2024-06-27  9:41     ` [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? (was: [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)]) Ihor Radchenko
@ 2024-06-28 12:47       ` Rudolf Adamkovič
  2024-06-28 13:46         ` Christian Moe
  2024-06-28 15:09       ` [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? Suhail Singh
  1 sibling, 1 reply; 6+ messages in thread
From: Rudolf Adamkovič @ 2024-06-28 12:47 UTC (permalink / raw)
  To: Ihor Radchenko, Sam Crawford; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> I'd like to hear from ob-R/ob-julia users whether the current behavior
> is something they rely on. If not, I'd prefer to follow the conventions
> we introduce in the manual and suppress the ESS's directory prompt.

+1 from me; I have always found that ESS prompt annoying.

Rudy
-- 
"Chop your own wood and it will warm you twice."
--- Henry Ford; Francis Kinloch, 1819; Henry David Thoreau, 1854

Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org


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

* Re: [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? (was: [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)])
  2024-06-28 12:47       ` Rudolf Adamkovič
@ 2024-06-28 13:46         ` Christian Moe
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Moe @ 2024-06-28 13:46 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Ihor Radchenko, Sam Crawford


Rudolf Adamkovič writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> I'd like to hear from ob-R/ob-julia users whether the current behavior
>> is something they rely on. If not, I'd prefer to follow the conventions
>> we introduce in the manual and suppress the ESS's directory prompt.
>
> +1 from me; I have always found that ESS prompt annoying.
>
> Rudy

+1; same, and I (rightly or wrongly) never rely on it for anything

Christian


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

* Re: [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory?
  2024-06-27  9:41     ` [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? (was: [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)]) Ihor Radchenko
  2024-06-28 12:47       ` Rudolf Adamkovič
@ 2024-06-28 15:09       ` Suhail Singh
  1 sibling, 0 replies; 6+ messages in thread
From: Suhail Singh @ 2024-06-28 15:09 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Sam Crawford, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> I'd like to hear from ob-R/ob-julia users whether the current behavior
> is something they rely on.

It's a (minor) nuisance, but one I'd be happy to have fixed.

-- 
Suhail


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

end of thread, other threads:[~2024-06-28 16:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 10:57 [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)] Sam Crawford
2024-06-26 13:23 ` Ihor Radchenko
     [not found]   ` <Eol9qrqro63gxtIvCHknY775AV2QB4sVptOEZY__3tyWRRgw7GkCfbxqahcbQoVgNoQeqJzzXs5fHS-7ocn3OqTE0hJSwW9HCmWF4lt6N6g=@crawf.uk>
2024-06-27  9:41     ` [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? (was: [BUG] Relative filenames for graphics output in ob-R.el [9.8-pre (release_9.7.4-80-g7fa169)]) Ihor Radchenko
2024-06-28 12:47       ` Rudolf Adamkovič
2024-06-28 13:46         ` Christian Moe
2024-06-28 15:09       ` [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? Suhail Singh

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