[Rd] Is it advisable/possible to default on Linux to an EDITOR that actually exists?
Michael Chirico
m|ch@e|ch|r|co4 @end|ng |rom gm@||@com
Tue Dec 10 17:08:10 CET 2024
It looks like R has defaulted to using 'vi' for file.edit() (via
EDITOR since ~24 years ago[1][2].
These days I think it is much more common to write code from
lightweight environments, e.g. Docker files which strip all
unnecessary commands. On such machines, it is not safe to assume 'vi'
is installed, and it's not uncommon to encounter an issue like I did
again today[3] where you or some other tool call file.edit() directly
or implicitly and hit a clunky error.
Is there something better to do here? A "standard" Linux distribution
will come with vi, emacs, nano, probably many others. Should
`file.edit()` iterate over an ordered list to find the first that
exists? Should it at least error if
(!nzchar(Sys.which(Sys.getenv("EDITOR"))))?
Mike C
PS I do see some somewhat recent discussion[4] on EDITOR but it
focuses on the EDITOR default in non-interactive() sessions.
[1] https://github.com/r-devel/r-svn/commit/b294ee2cef3d9292d578b062b80d59f372cf34b2#diff-1cbaac4768fd110525ba9086cb7a684aaf2c6555389c5446c913effbfec90c85
[2] https://github.com/r-devel/r-svn/blob/71a2e968f4453858aadc1531a3774c011a6f9f49/doc/NEWS.0#L140-L141
[3] https://github.com/r-lib/usethis/pull/2088
[4] https://stat.ethz.ch/pipermail/r-devel/2023-July/082720.html
More information about the R-devel
mailing list