[ESS] run R code upon starting each ESS session
Dirk Eddelbuettel
edd @end|ng |rom deb|@n@org
Tue Oct 3 19:12:00 CEST 2023
On 3 October 2023 at 18:52, Manuel Teodoro via ESS-help wrote:
| Is there a way to run R code upon starting each ESS session?
|
| Something like Rprofile but I'd like to make it more dependent to emacs.
|
| What I want is to have a few options settings in my R sessions by default.
| Since I use it in different computers but my Emacs configuration is shared
| among all of them, I would prefer to keep this also within my emacs config.
|
| It can be either calling an R script, specifying the path to Rprofile
| directly to ESS or passing a string of R code to run at startup.
|
| Any ideas are appreciated
Cool question. My immediate thought (weighted by the fact that I cannot write
elisp code ;-) ) was to test for that in the _the standard R startup files_.
A quick check of what `Sys.getenv()` returns inside Emacs reveals the
`INSIDE_EMACS` env var so now I just added
if (interactive() && nzchar(Sys.getenv("INSIDE_EMACS"))) {
cat("Hello Emacs user.\n")
}
to the bottom of .Rprofile and indeed:
[... other stuff including the fortunes::fortune call output ...]
Hello Emacs user.
> setwd('/home/edd/')
>
but not when I start R on the terminal. That could be start for you.
Dirk
--
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
More information about the ESS-help
mailing list