From: stardiviner <numbchild@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Sam Crawford <sam@crawf.uk>, Org-mode <emacs-orgmode@gnu.org>
Subject: Re: The ob-R :results graphics file :dir "images" :file "plot.png" specified directory not working
Date: Tue, 14 Jan 2025 13:29:25 +0800 [thread overview]
Message-ID: <CAL1eYuLsmp98X0ySmWf=dxSnkrSLPcbrfEJeOqBqezN18XXFHg@mail.gmail.com> (raw)
In-Reply-To: <CAL1eYuK2jCG-UhEtJ+GWq3MMEpD+Q3rfX=MyFawBkuyYseRMzg@mail.gmail.com>
[-- 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]]
next prev parent reply other threads:[~2025-01-14 6:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAL1eYuLsmp98X0ySmWf=dxSnkrSLPcbrfEJeOqBqezN18XXFHg@mail.gmail.com' \
--to=numbchild@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=sam@crawf.uk \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).