* [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; 13+ 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] 13+ 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; 13+ 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] 13+ 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č
` (2 more replies)
0 siblings, 3 replies; 13+ 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] 13+ 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
2024-08-06 8:43 ` [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
2 siblings, 1 reply; 13+ 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] 13+ 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; 13+ 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] 13+ 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
2024-08-06 8:43 ` [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
2 siblings, 0 replies; 13+ 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] 13+ 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 15:09 ` [POLL] ob-R, ob-julia: Should we force-disable ess-ask-for-ess-directory? Suhail Singh
@ 2024-08-06 8:43 ` Ihor Radchenko
2025-01-14 5:10 ` The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working stardiviner
2 siblings, 1 reply; 13+ messages in thread
From: Ihor Radchenko @ 2024-08-06 8:43 UTC (permalink / raw)
To: 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.
The responses expressed no objections to the change.
So, ob-R and ob-julia now obey the working directory conventions common
for the rest of babel backends - use default-directory or :dir; no
queries.
Closed.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=62b88d613e
--
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] 13+ messages in thread
* The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working
2024-08-06 8:43 ` [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
@ 2025-01-14 5:10 ` stardiviner
2025-01-14 5:29 ` stardiviner
0 siblings, 1 reply; 13+ messages in thread
From: stardiviner @ 2025-01-14 5:10 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Sam Crawford, Org-mode
[-- Attachment #1: Type: text/plain, Size: 1794 bytes --]
This seems not working, I have following example:
In Org mode file "~/Org/Programming/R/test.org"
#+begin_src R :results graphics file :dir "images" :file "hist_rnorm.png"
x <- rnorm(100)
print(mean(x))
hist(x)
#+end_src
#+RESULTS[(2025-01-14 11:19:59) 2387108d2b01bf63b1eac4044a7430ea7ba87466]:
[[file:images/hist_rnorm.png]]
The generated plot image "images/hist_rnorm.png" is NOT in
"~/Org/Programming/R/images/hist_rnorm.png". It's in "~/Org/hist_rnorm.png".
My environment:
- Emacs version: GNU Emacs 31.0.50 (commit nil)
- Org mode version: 9.8-pre (using branch "main" latest commit "c2d57df0e")
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Tue, Aug 6, 2024 at 4:42 PM Ihor Radchenko <yantar92@posteo.net> wrote:
> 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.
>
> The responses expressed no objections to the change.
> So, ob-R and ob-julia now obey the working directory conventions common
> for the rest of babel backends - use default-directory or :dir; no
> queries.
>
> Closed.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=62b88d613e
>
> --
> 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>
>
>
[-- Attachment #2: Type: text/html, Size: 3007 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working
2025-01-14 5:10 ` The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working stardiviner
@ 2025-01-14 5:29 ` stardiviner
2025-01-14 10:49 ` sam--- via General discussions about Org-mode.
0 siblings, 1 reply; 13+ messages in thread
From: stardiviner @ 2025-01-14 5:29 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Sam Crawford, Org-mode
[-- Attachment #1.1: Type: text/plain, Size: 2417 bytes --]
I tested using org-mode's `make repro` clean Emacs & org-mode environment
instance. It works fine. I double checked my Emacs init file about R
settings. Have not found suspicious config.
Here is my reproduce test.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Tue, Jan 14, 2025 at 1:10 PM stardiviner <numbchild@gmail.com> wrote:
> This seems not working, I have following example:
>
> In Org mode file "~/Org/Programming/R/test.org"
>
> #+begin_src R :results graphics file :dir "images" :file "hist_rnorm.png"
> x <- rnorm(100)
> print(mean(x))
> hist(x)
> #+end_src
>
> #+RESULTS[(2025-01-14 11:19:59) 2387108d2b01bf63b1eac4044a7430ea7ba87466]:
> [[file:images/hist_rnorm.png]]
>
> The generated plot image "images/hist_rnorm.png" is NOT in
> "~/Org/Programming/R/images/hist_rnorm.png". It's in
> "~/Org/hist_rnorm.png".
>
> My environment:
> - Emacs version: GNU Emacs 31.0.50 (commit nil)
> - Org mode version: 9.8-pre (using branch "main" latest commit "c2d57df0e")
>
> [stardiviner] <Hack this world!> GPG key ID: 47C32433
> IRC(freeenode): stardiviner Twitter: @numbchild
> Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
> Blog: http://stardiviner.github.io/
>
>
> On Tue, Aug 6, 2024 at 4:42 PM Ihor Radchenko <yantar92@posteo.net> wrote:
>
>> 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.
>>
>> The responses expressed no objections to the change.
>> So, ob-R and ob-julia now obey the working directory conventions common
>> for the rest of babel backends - use default-directory or :dir; no
>> queries.
>>
>> Closed.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=62b88d613e
>>
>> --
>> 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>
>>
>>
[-- Attachment #1.2: Type: text/html, Size: 4340 bytes --]
[-- Attachment #2: test-ob-R.org --]
[-- Type: application/octet-stream, Size: 10993 bytes --]
* test org-mode
#+begin_src sh
# open a clean Emacs & Org mode instance.
make repro
#+end_src
* load ESS
#+begin_src emacs-lisp
(package-initialize)
#+end_src
#+begin_src emacs-lisp
(use-package ess
:ensure t
:defer t
:mode (("\\.[rR]\\'" . R-mode)
("\\.Rd\\'" . Rd-mode) ; R documentation
("\\.Rprofile\\'" . R-mode)
("\\.Renviron\\'" . R-mode)
("\\.S\\'" . S-mode))
:commands (R run-ess-r)
:custom ((ess-ask-for-ess-directory nil) ; suppress ESS from prompting for session directory
(ess-R-readline nil) ; whether start REPL with `--no-readline' argument?
;; (inferior-ess-primary-prompt "ℝ> ") ; customized R prompt
;; (inferior-S-prompt "[]a-zA-Z0-9.[]*\\(?:[>+.] \\)*ℝ+> ") ; handle the custom ℝ prompt
(ess-use-ido nil)
(ess-describe-at-point-method 'tooltip)
(ess-eval-visibly nil) ; speedup eval without show the eval commands.
(ess-use-company t)
(ess-use-auto-complete nil))
:init
(add-to-list 'display-buffer-alist '("\\*R[:*:*]?\\*" . (display-buffer-below-selected)))
(add-to-list 'display-buffer-alist '("\\*help\\[R\\]\\(.*\\)\\*" . (display-buffer-below-selected)))
(add-to-list 'display-buffer-alist '("\\*ess-apropos\\[R\\]\\(.*\\)\\*" . (display-buffer-below-selected)))
:config
;; auto start ESS inferior process
;; (add-hook 'ess-mode-hook #'ess-force-buffer-current)
;; quickly insert assign operator: <-
(with-eval-after-load 'ess-mode
(define-key ess-mode-map (kbd "C-c =") (lambda () (interactive) (insert " <- ")))))
#+end_src
#+RESULTS:
: ((\.S\' . S-mode) (\.Renviron\' . R-mode) (\.Rprofile\' . R-mode) (\.Rd\' . Rd-mode) (\.[rR]\' . R-mode) (\.gpg\(~\|\.~[0-9]+~\)?\' nil epa-file) (\.elc\' . elisp-byte-code-mode) (\.zst\' nil jka-compr) (\.dz\' nil jka-compr) (\.xz\' nil jka-compr) (\.lzma\' nil jka-compr) (\.lz\' nil jka-compr) (\.g?z\' nil jka-compr) (\.bz2\' nil jka-compr) (\.Z\' nil jka-compr) (\.vr[hi]?\' . vera-mode) (\(?:\.\(?:rbw?\|ru\|rake\|thor\|axlsx\|jbuilder\|rabl\|gemspec\|podspec\)\|/\(?:Gem\|Rake\|Cap\|Thor\|Puppet\|Berks\|Brew\|Fast\|Vagrant\|Guard\|Pod\)file\)\' . ruby-mode) (\.re?st\' . rst-mode) (/\(?:Pipfile\|\.?flake8\)\' . conf-mode) (\(?:\.\(?:p\(?:th\|y[iw]?\)\)\|/\(?:SCons\(?:\(?:crip\|truc\)t\)\)\)\' . python-mode) (\.m\' . octave-maybe-mode) (\.less\' . less-css-mode) (\.editorconfig\' . editorconfig-conf-mode) (\.scss\' . scss-mode) (\.cs\' . csharp-mode) (\.awk\' . awk-mode) (\.\(u?lpc\|pike\|pmod\(\.in\)?\)\' . pike-mode) (\.idl\' . idl-mode) (\.java\' . java-mode) (\.m\' . objc-mode) (\.ii\' . c++-mode) (\.i\' . c-mode) (\.lex\' . c-mode) (\.y\(acc\)?\' . c-mode) (\.h\' . c-or-c++-mode) (\.c\' . c-mode) (\.\(CC?\|HH?\)\' . c++-mode) (\.[ch]\(pp\|xx\|\+\+\)\' . c++-mode) (\.\(cc\|hh\)\' . c++-mode) (\.\(bat\|cmd\)\' . bat-mode) (\.[sx]?html?\(\.[a-zA-Z_]+\)?\' . mhtml-mode) (\.svgz?\' . image-mode) (\.svgz?\' . xml-mode) (\.x[bp]m\' . image-mode) (\.x[bp]m\' . c-mode) (\.p[bpgn]m\' . image-mode) (\.tiff?\' . image-mode) (\.gif\' . image-mode) (\.png\' . image-mode) (\.jpe?g\' . image-mode) (\.webp\' . image-mode) (\.te?xt\' . text-mode) (\.[tT]e[xX]\' . tex-mode) (\.ins\' . tex-mode) (\.ltx\' . latex-mode) (\.dtx\' . doctex-mode) (\.org\' . org-mode) (\.dir-locals\(?:-2\)?\.el\' . lisp-data-mode) (\.eld\' . lisp-data-mode) (eww-bookmarks\' . lisp-data-mode) (tramp\' . lisp-data-mode) (/archive-contents\' . lisp-data-mode) (places\' . lisp-data-mode) (\.emacs-places\' . lisp-data-mode) (\.el\' . emacs-lisp-mode) (Project\.ede\' . emacs-lisp-mode) (\(?:\.\(?:scm\|sls\|sld\|stk\|ss\|sch\)\|/\.guile\)\' . scheme-mode) (\.l\' . lisp-mode) (\.li?sp\' . lisp-mode) (\.[fF]\' . fortran-mode) (\.for\' . fortran-mode) (\.p\' . pascal-mode) (\.pas\' . pascal-mode) (\.\(dpr\|DPR\)\' . delphi-mode) (\.\([pP]\([Llm]\|erl\|od\)\|al\)\' . perl-mode) (Imakefile\' . makefile-imake-mode) (Makeppfile\(?:\.mk\)?\' . makefile-makepp-mode) (\.makepp\' . makefile-makepp-mode) (\.mk\' . makefile-bsdmake-mode) (\.make\' . makefile-bsdmake-mode) (GNUmakefile\' . makefile-gmake-mode) ([Mm]akefile\' . makefile-bsdmake-mode) (\.am\' . makefile-automake-mode) (\.texinfo\' . texinfo-mode) (\.te?xi\' . texinfo-mode) (\.[sS]\' . asm-mode) (\.asm\' . asm-mode) (\.css\' . css-mode) (\.mixal\' . mixal-mode) (\.gcov\' . compilation-mode) (/\.[a-z0-9-]*gdbinit . gdb-script-mode) (-gdb\.gdb . gdb-script-mode) ([cC]hange\.?[lL]og?\' . change-log-mode) ([cC]hange[lL]og[-.][0-9]+\' . change-log-mode) (\$CHANGE_LOG\$\.TXT . change-log-mode) (\.scm\.[0-9]*\' . scheme-mode) (\.[ckz]?sh\'\|\.shar\'\|/\.z?profile\' . sh-mode) (\.bash\' . sh-mode) (/bash-fc\.[0-9A-Za-z]\{6\}\' . sh-mode) (/PKGBUILD\' . sh-mode) (\(/\|\`\)\.\(bash_\(profile\|history\|log\(in\|out\)\)\|z?log\(in\|out\)\)\' . sh-mode) (\(/\|\`\)\.\(shrc\|zshrc\|m?kshrc\|bashrc\|t?cshrc\|esrc\)\' . sh-mode) (\(/\|\`\)\.\([kz]shenv\|xinitrc\|startxrc\|xsession\)\' . sh-mode) (\.m?spec\' . sh-mode) (\.m[mes]\' . nroff-mode) (\.man\' . nroff-mode) (\.sty\' . latex-mode) (\.cl[so]\' . latex-mode) (\.bbl\' . latex-mode) (\.bib\' . bibtex-mode) (\.bst\' . bibtex-style-mode) (\.sql\' . sql-mode) (\(acinclude\|aclocal\|acsite\)\.m4\' . autoconf-mode) (\.m[4c]\' . m4-mode) (\.mf\' . metafont-mode) (\.mp\' . metapost-mode) (\.vhdl?\' . vhdl-mode) (\.article\' . text-mode) (\.letter\' . text-mode) (\.i?tcl\' . tcl-mode) (\.exp\' . tcl-mode) (\.itk\' . tcl-mode) (\.icn\' . icon-mode) (\.sim\' . simula-mode) (\.mss\' . scribe-mode) (\.f9[05]\' . f90-mode) (\.f0[38]\' . f90-mode) (\.indent\.pro\' . fundamental-mode) (\.\(pro\|PRO\)\' . idlwave-mode) (\.srt\' . srecode-template-mode) (\.prolog\' . prolog-mode) (\.tar\' . tar-mode) (\.\(arc\|zip\|lzh\|lha\|zoo\|[jew]ar\|xpi\|rar\|cbr\|7z\|squashfs\|ARC\|ZIP\|LZH\|LHA\|ZOO\|[JEW]AR\|XPI\|RAR\|CBR\|7Z\|SQUASHFS\)\' . archive-mode) (\.oxt\' . archive-mode) (\.\(deb\|[oi]pk\)\' . archive-mode) (\`/tmp/Re . text-mode) (/Message[0-9]*\' . text-mode) (\`/tmp/fol/ . text-mode) (\.oak\' . scheme-mode) (\.sgml?\' . sgml-mode) (\.x[ms]l\' . xml-mode) (\.dbk\' . xml-mode) (\.dtd\' . sgml-mode) (\.ds\(ss\)?l\' . dsssl-mode) (\.js[mx]?\' . javascript-mode) (\.har\' . javascript-mode) (\.json\' . js-json-mode) (\.[ds]?va?h?\' . verilog-mode) (\.by\' . bovine-grammar-mode) (\.wy\' . wisent-grammar-mode) (\.erts\' . erts-mode) ([:/\]\..*\(emacs\|gnus\|viper\)\' . emacs-lisp-mode) (\`\..*emacs\' . emacs-lisp-mode) ([:/]_emacs\' . emacs-lisp-mode) (/crontab\.X*[0-9]+\' . shell-script-mode) (\.ml\' . lisp-mode) (\.ld[si]?\' . ld-script-mode) (ld\.?script\' . ld-script-mode) (\.xs\' . c-mode) (\.x[abdsru]?[cnw]?\' . ld-script-mode) (\.zone\' . dns-mode) (\.soa\' . dns-mode) (\.asd\' . lisp-mode) (\.\(asn\|mib\|smi\)\' . snmp-mode) (\.\(as\|mi\|sm\)2\' . snmpv2-mode) (\.\(diffs?\|patch\|rej\)\' . diff-mode) (\.\(dif\|pat\)\' . diff-mode) (\.[eE]?[pP][sS]\' . ps-mode) (\.\(?:PDF\|EPUB\|CBZ\|FB2\|O?XPS\|DVI\|OD[FGPST]\|DOCX\|XLSX?\|PPTX?\|pdf\|epub\|cbz\|fb2\|o?xps\|djvu\|dvi\|od[fgpst]\|docx\|xlsx?\|pptx?\)\' . doc-view-mode-maybe) (configure\.\(ac\|in\)\' . autoconf-mode) (\.s\(v\|iv\|ieve\)\' . sieve-mode) (BROWSE\' . ebrowse-tree-mode) (\.ebrowse\' . ebrowse-tree-mode) (#\*mail\* . mail-mode) (\.g\' . antlr-mode) (\.mod\' . m2-mode) (\.ses\' . ses-mode) (\.docbook\' . sgml-mode) (\.com\' . dcl-mode) (/config\.\(?:bat\|log\)\' . fundamental-mode) (/\.?\(authinfo\|netrc\)\' . authinfo-mode) (\.\(?:[iI][nN][iI]\|[lL][sS][tT]\|[rR][eE][gG]\|[sS][yY][sS]\)\' . conf-mode) (\.la\' . conf-unix-mode) (\.ppd\' . conf-ppd-mode) (java.+\.conf\' . conf-javaprop-mode) (\.properties\(?:\.[a-zA-Z0-9._-]+\)?\' . conf-javaprop-mode) (\.toml\' . conf-toml-mode) (\.desktop\' . conf-desktop-mode) (/\.redshift\.conf\' . conf-windows-mode) (\`/etc/\(?:DIR_COLORS\|ethers\|.?fstab\|.*hosts\|lesskey\|login\.?de\(?:fs\|vperm\)\|magic\|mtab\|pam\.d/.*\|permissions\(?:\.d/.+\)?\|protocols\|rpc\|services\)\' . conf-space-mode) (\`/etc/\(?:acpid?/.+\|aliases\(?:\.d/.+\)?\|default/.+\|group-?\|hosts\..+\|inittab\|ksysguarddrc\|opera6rc\|passwd-?\|shadow-?\|sysconfig/.+\)\' . conf-mode) ([cC]hange[lL]og[-.][-0-9a-z]+\' . change-log-mode) (/\.?\(?:gitconfig\|gnokiirc\|hgrc\|kde.*rc\|mime\.types\|wgetrc\)\' . conf-mode) (/\.mailmap\' . conf-unix-mode) (/\.\(?:asound\|enigma\|fetchmail\|gltron\|gtk\|hxplayer\|mairix\|mbsync\|msmtp\|net\|neverball\|nvidia-settings-\|offlineimap\|qt/.+\|realplayer\|reportbug\|rtorrent\.\|screen\|scummvm\|sversion\|sylpheed/.+\|xmp\)rc\' . conf-mode) (/\.\(?:gdbtkinit\|grip\|mpdconf\|notmuch-config\|orbital/.+txt\|rhosts\|tuxracer/options\)\' . conf-mode) (/\.?X\(?:default\|resource\|re\)s\> . conf-xdefaults-mode) (/X11.+app-defaults/\|\.ad\' . conf-xdefaults-mode) (/X11.+locale/.+/Compose\' . conf-colon-mode) (/X11.+locale/compose\.dir\' . conf-javaprop-mode) (\.~?[0-9]+\.[0-9][-.0-9]*~?\' nil t) (\.\(?:orig\|in\|[bB][aA][kK]\)\' nil t) ([/.]c\(?:on\)?f\(?:i?g\)?\(?:\.[a-zA-Z0-9._-]+\)?\' . conf-mode-maybe) (\.[1-9]\' . nroff-mode) (\.art\' . image-mode) (\.avs\' . image-mode) (\.bmp\' . image-mode) (\.cmyk\' . image-mode) (\.cmyka\' . image-mode) (\.crw\' . image-mode) (\.dcr\' . image-mode) (\.dcx\' . image-mode) (\.dng\' . image-mode) (\.dpx\' . image-mode) (\.fax\' . image-mode) (\.heic\' . image-mode) (\.hrz\' . image-mode) (\.icb\' . image-mode) (\.icc\' . image-mode) (\.icm\' . image-mode) (\.ico\' . image-mode) (\.icon\' . image-mode) (\.jbg\' . image-mode) (\.jbig\' . image-mode) (\.jng\' . image-mode) (\.jnx\' . image-mode) (\.miff\' . image-mode) (\.mng\' . image-mode) (\.mvg\' . image-mode) (\.otb\' . image-mode) (\.p7\' . image-mode) (\.pcx\' . image-mode) (\.pdb\' . image-mode) (\.pfa\' . image-mode) (\.pfb\' . image-mode) (\.picon\' . image-mode) (\.pict\' . image-mode) (\.rgb\' . image-mode) (\.rgba\' . image-mode) (\.tga\' . image-mode) (\.wbmp\' . image-mode) (\.webp\' . image-mode) (\.wmf\' . image-mode) (\.wpg\' . image-mode) (\.xcf\' . image-mode) (\.xmp\' . image-mode) (\.xwd\' . image-mode) (\.yuv\' . image-mode) (\.tgz\' . tar-mode) (\.tbz2?\' . tar-mode) (\.txz\' . tar-mode) (\.tzst\' . tar-mode))
* load ob-R
#+begin_src emacs-lisp
(use-package ob-R
:defer t
:after org
:init
(add-to-list 'org-babel-load-languages '(R . t))
(org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)
(add-to-list 'org-src-lang-modes '("R" . R)) ; `ess-r-mode'
(add-to-list 'org-babel-tangle-lang-exts '("R" . "R"))
:config
(setq org-babel-default-header-args:R
'((:session . "*R*")
(:exports . "both")
(:results . "replace")
;; customize R plot window
;; (:width . 640)
;; (:height . 640)
;; (:bg . "white")
;; (:type . :any)
)))
#+end_src
#+RESULTS:
: t
* test ob-R
#+begin_src R :results graphics file :dir "images" :file "hist_rnorm.png"
x <- rnorm(100)
print(mean(x))
hist(x)
#+end_src
#+RESULTS:
[[file:images/hist_rnorm.png]]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working
2025-01-14 5:29 ` stardiviner
@ 2025-01-14 10:49 ` sam--- via General discussions about Org-mode.
2025-01-14 16:04 ` stardiviner
2025-01-14 16:09 ` stardiviner
0 siblings, 2 replies; 13+ messages in thread
From: sam--- via General discussions about Org-mode. @ 2025-01-14 10:49 UTC (permalink / raw)
To: stardiviner; +Cc: Ihor Radchenko, Org-mode
[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]
On 2025-01-14 05:29, stardiviner wrote:
> I tested using org-mode's `make repro` clean Emacs & org-mode
> environment instance. It works fine. I double checked my Emacs init
> file about R settings. Have not found suspicious config.
So to confirm, you *cannot* reproduce the error with a clean config?
> Here is my reproduce test.
I tried running this, and it seems to work as expected.
>> The generated plot image "images/hist_rnorm.png" is NOT in
>> "~/Org/Programming/R/images/hist_rnorm.png". It's in
>> "~/Org/hist_rnorm.png".
Some relevant settings that may be altered by your config are
`ess-startup-directory` and `ess-startup-directory-function`. It might
be, for example, that one of these is forcibly changing the R process'
working directory to a project root ("~/Org", in this instance)
By the way, setting `:dir` changes the *working* directory, which you
might not want to be "images". There is a separate header argument,
`:output-dir` that can be used for this purpose.
Sam
[-- Attachment #2: Type: text/html, Size: 1744 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working
2025-01-14 10:49 ` sam--- via General discussions about Org-mode.
@ 2025-01-14 16:04 ` stardiviner
2025-01-15 3:31 ` William Denton
2025-01-14 16:09 ` stardiviner
1 sibling, 1 reply; 13+ messages in thread
From: stardiviner @ 2025-01-14 16:04 UTC (permalink / raw)
To: sam; +Cc: Ihor Radchenko, Org-mode
[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]
Finally found the real reason: package `project-rootfile` -> (add-to-list
'project-find-functions #'project-rootfile-try-detect t)
I don't know why project-rootfile involved in the Org mode Babel source
block execution path.
I checked out the source code of `project-rootfile`. Have not found any
clue.
Anyone have thoughts on this weird problem?
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Tue, Jan 14, 2025 at 6:49 PM <sam@crawf.uk> wrote:
> On 2025-01-14 05:29, stardiviner wrote:
>
> I tested using org-mode's `make repro` clean Emacs & org-mode environment
> instance. It works fine. I double checked my Emacs init file about R
> settings. Have not found suspicious config.
>
>
> So to confirm, you *cannot* reproduce the error with a clean config?
>
> Here is my reproduce test.
>
>
> I tried running this, and it seems to work as expected.
>
> The generated plot image "images/hist_rnorm.png" is NOT in
> "~/Org/Programming/R/images/hist_rnorm.png". It's in
> "~/Org/hist_rnorm.png".
>
>
> Some relevant settings that may be altered by your config are
> `ess-startup-directory` and `ess-startup-directory-function`. It might be,
> for example, that one of these is forcibly changing the R process' working
> directory to a project root ("~/Org", in this instance)
>
> By the way, setting `:dir` changes the *working* directory, which you
> might not want to be "images". There is a separate header argument,
> `:output-dir` that can be used for this purpose.
>
> Sam
>
[-- Attachment #2: Type: text/html, Size: 3302 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working
2025-01-14 10:49 ` sam--- via General discussions about Org-mode.
2025-01-14 16:04 ` stardiviner
@ 2025-01-14 16:09 ` stardiviner
1 sibling, 0 replies; 13+ messages in thread
From: stardiviner @ 2025-01-14 16:09 UTC (permalink / raw)
To: sam; +Cc: Ihor Radchenko, Org-mode
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --]
> Some relevant settings that may be altered by your config are
`ess-startup-directory` and `ess-startup-directory-function`. It might be,
for example, that one of these is forcibly changing the R process' working
directory to a project root ("~/Org", in this instance)
Yes, I found the reason `project-rootfile` changed the directory when babel
source block execution.
> By the way, setting `:dir` changes the *working* directory, which you
might not want to be "images". There is a separate header argument,
`:output-dir` that can be used for this purpose.
Thanks for your tips.
[stardiviner] <Hack this world!> GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter: @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
On Tue, Jan 14, 2025 at 6:49 PM <sam@crawf.uk> wrote:
> On 2025-01-14 05:29, stardiviner wrote:
>
> I tested using org-mode's `make repro` clean Emacs & org-mode environment
> instance. It works fine. I double checked my Emacs init file about R
> settings. Have not found suspicious config.
>
>
> So to confirm, you *cannot* reproduce the error with a clean config?
>
> Here is my reproduce test.
>
>
> I tried running this, and it seems to work as expected.
>
> The generated plot image "images/hist_rnorm.png" is NOT in
> "~/Org/Programming/R/images/hist_rnorm.png". It's in
> "~/Org/hist_rnorm.png".
>
>
> Some relevant settings that may be altered by your config are
> `ess-startup-directory` and `ess-startup-directory-function`. It might be,
> for example, that one of these is forcibly changing the R process' working
> directory to a project root ("~/Org", in this instance)
>
> By the way, setting `:dir` changes the *working* directory, which you
> might not want to be "images". There is a separate header argument,
> `:output-dir` that can be used for this purpose.
>
> Sam
>
[-- Attachment #2: Type: text/html, Size: 4398 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working
2025-01-14 16:04 ` stardiviner
@ 2025-01-15 3:31 ` William Denton
0 siblings, 0 replies; 13+ messages in thread
From: William Denton @ 2025-01-15 3:31 UTC (permalink / raw)
To: stardiviner; +Cc: Org-mode
On Tuesday, January 14th, 2025 at 11:04, stardiviner <numbchild@gmail.com> wrote:
> Finally found the real reason: package `project-rootfile` -> (add-to-list 'project-find-functions #'project-rootfile-try-detect t)
> I don't know why project-rootfile involved in the Org mode Babel source block execution path.
> I checked out the source code of `project-rootfile`. Have not found any clue.
> Anyone have thoughts on this weird problem?
I think you've identified the same kind of problem I have. I have some Org files with R code that I run in a session, and I want the working directory to be the directory the files are in (.) but it is one up (..). I couldn't figure out why it happened, because it wasn't happening with "make repro" tests. But now that I look at it, this happens in files that are in projects or Git repositories. I don't use the package you do, though, just built-in projects.el. Still, maybe it's the same thing?
Bill
--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-01-15 4:04 UTC | newest]
Thread overview: 13+ 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
2024-08-06 8:43 ` [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
2025-01-14 5:10 ` The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working stardiviner
2025-01-14 5:29 ` stardiviner
2025-01-14 10:49 ` sam--- via General discussions about Org-mode.
2025-01-14 16:04 ` stardiviner
2025-01-15 3:31 ` William Denton
2025-01-14 16:09 ` stardiviner
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).