diff --git a/doc/org/.dir-locals.el.in b/doc/org/.dir-locals.el.in
index cba9892fb..80c0a1385 100644
--- a/doc/org/.dir-locals.el.in
+++ b/doc/org/.dir-locals.el.in
@@ -27,6 +27,9 @@
(setenv "SPOT_DOTEXTRA" "node[fontsize=12] fontsize=12 stylesheet=\"spot.css\" edge[arrowhead=vee, arrowsize=.7, fontsize=12]")
(setq org-babel-temporary-directory "@abs_top_builddir@/doc/org/tmp")
(make-directory org-babel-temporary-directory t)
+ ; has to be set globally, not buffer-local
+ (setq ess-ask-for-ess-directory nil)
+ (setq ess-startup-directory 'default-directory)
(org-babel-do-load-languages 'org-babel-load-languages
`((,(if (version< org-version "8.3") 'sh 'shell) . t)
(python . t)
@@ -39,7 +42,6 @@
(org-babel-python-command . "@PYTHON@")
(org-babel-C++-compiler . "./g++wrap")
(shell-file-name . "@SHELL@")
- (ess-ask-for-ess-directory . nil)
(org-export-html-postamble . nil)
(org-html-table-header-tags
"
" . " | ")
diff --git a/doc/org/init.el.in b/doc/org/init.el.in
index 5e51c7250..4258a95f7 100644
--- a/doc/org/init.el.in
+++ b/doc/org/init.el.in
@@ -88,7 +88,9 @@
(setq org-babel-C++-compiler "./g++wrap")
(setq shell-file-name "@SHELL@")
(setq ess-ask-for-ess-directory nil)
-
+; setting ess-startup-directory to 'default-directory is enough with
+; newer ESS version (after Fev 2022) but does not work with older ones.
+(setq ess-startup-directory "@abs_top_builddir@/doc/org")
(setq org-babel-default-header-args:plantuml
'((:results . "file")
(:exports . "results")
diff --git a/doc/org/ltlcross.org b/doc/org/ltlcross.org
index 0fdebae1f..36cce5cbb 100644
--- a/doc/org/ltlcross.org
+++ b/doc/org/ltlcross.org
@@ -924,7 +924,7 @@ compare the number of states produced by the two configurations of
=ltl2tgba= for each formula, we just need to plot column
=dt2$state.small= against =dt2$state.deter=.
-#+BEGIN_SRC R :results output graphics :width 5 :height 5 :file ltlcross-r.svg
+#+BEGIN_SRC R :results output graphics file :width 5 :height 5 :file ltlcross-r.svg
library(ggplot2)
ggplot(dt2, aes(x=states.small, y=states.deter)) +
geom_abline(colour='white') + geom_point()
@@ -937,7 +937,7 @@ ggplot(dt2, aes(x=states.small, y=states.deter)) +
We should probably print the formulas for the cases where the two
sizes differ.
-#+BEGIN_SRC R :results output graphics :width 5 :height 5 :file ltlcross-r2.svg
+#+BEGIN_SRC R :results output graphics file :width 5 :height 5 :file ltlcross-r2.svg
ggplot(dt2, aes(x=states.small, y=states.deter)) +
geom_abline(colour='white') + geom_point() +
geom_text(data=subset(dt2, states.small != states.deter),