[Rd] Is it advisable/possible to default on Linux to an EDITOR that actually exists?
Dirk Eddelbuettel
edd @end|ng |rom deb|@n@org
Tue Dec 10 17:46:28 CET 2024
Michael,
This looks rather like a 'compile-time versus run-time' question to me. If
you look at etc/Renviron.in in the R sources you see a number of choices,
some of them with configure-time determined values (which I tend to override
with values for the Debian package).
For 'EDIT' it is
## Default editor
EDITOR=${EDITOR-${VISUAL-vi}}
giving us two env vars to override eg in 'degenerate' situations such as the
forcefully minimized docker setup without other commands.
Otherwise, a generalization that would be possible might be to do something
similar to 'R CMD javareconf' to allow a later run-time call to affect the
encoded values---which would then be read at startup. On the other hand,
environment variables already give customization so ...
Linux distributions can also have their mechanism. For example, Debian has
/etc/alternatives which for 'editor' defaults to nano even when vi, emacs,
mg, atom, code, ... are installed. So you could also have the environment
variable EDITOR point to a script you control which then runs over possible
alternatives.
As for the conjecture 'it is much more common to write code from ...' I
would love to see some empirics across a properly surveyed R user base. The
love of some power users for codespaces / devcontainers notwithstanding, 'the
most common' environment for writing R code is likely still what it always
was, a single windows desktop.
Anyway, thanks for raising this. I can look into making the Debian (and hence
Ubuntu) package switch to 'editor' over the vi fallback.
Dirk
--
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
More information about the R-devel
mailing list