[Rd] New behavior when running script in package directory?

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Wed Jun 21 18:26:47 CEST 2023


On Wed, 21 Jun 2023 11:49:24 -0400
Dominick Samperi <djsamperi using gmail.com> wrote:

> 1. Why does Emacs/ESS behave differently depending on the
> current working directory?
> 2. Why is the signal package loaded automatically?

There's a "package development mode" in ESS:
https://github.com/emacs-ess/ESS/blob/master/lisp/ess-r-package.el

I think that ESS automatically detects that you're inside a package
directory and adjusts its behaviour. This could be related to
"namespaced evaluation"
<https://ess.r-project.org/Manual/ess.html#Namespaced-Evaluation>
("evaluate code in the context of the package being developed", sounds
useful), but I'm not sure about that.

> 3. Why is that temporary file /tmp/foo.R!djSwRn created?

It's probably some part of ESS's mechanism of running R code. I don't
see where the temporary file name is constructed (maybe a built-in
Emacs function?), but it probably comes from
<https://github.com/emacs-ess/ESS/blob/master/lisp/ess-r-mode.el>.
(Look for calls to .ess.source or .ess.ns_source.)

> 4. What is that function ss() in the error message referring to?

`ss` is a function defined by ESS in order to call R's source() in a
way portable between a very wide range of R versions. (A comment in the
same file says "Should work on *all* versions of R. Do not use _ in
names, nor :: , nor 1L", which includes versions of R considered very
old by now.):

https://github.com/emacs-ess/ESS/blob/master/etc/ESSR/R/.basic.R#L178

> 5. Could this be a virus? Under Ubuntu?

A virus has little reason to be doing this to you. There's much more
money to be made from malicious VSCode extensions than Emacs add-on
packages.

Since you've determined ESS to be causing the difference in the
behaviour, perhaps
<https://ess.r-project.org/index.php?Section=getting%20help> is the way
to go? Unfortunately, I'm not a user of ESS or Emacs, so I'm going off
what information I found on the Web, which may be outdated.

-- 
Best regards,
Ivan



More information about the R-devel mailing list