I do agree we're probably spending more time on this than it's worth so feel free to let it die here :)
> "If on systems that don't have all tools, maybe don't call functions from > package `usethis`" What I have in mind here is (1) less experienced users who (2) are running in environments handed to them which were (3) set up by someone (e.g. an instructor) who either wasn't aware of this issue (seems likely) or didn't anticipate their users trying to edit files from R (e.g. because they are set up in an IDE like VSCode). This user is particularly prone to getting stuck on an issue where R throws a vague warning while the "real error" is hidden within other output and doesn't take a form they're used to (a shell error instead of an R error). There are other packages besides {usethis} which can apparently run file.edit(): https://github.com/search?q=org%3Acran+lang%3AR+%2F%5Cn%5B%5E%23%5Cn%5D*%5B%5E+%5Cw%3A%5D%5Cs*file%5B.%5Dedit%5B%28%5D%28%5B%5E%5C%5C%5D%7C%5B%5E%27%5D%7C%5B%27%5D%5B%5E%22%7B%5D%7C%5B%5E%22%5D%7C%5B%22%5D%5B%5E%27%7B%5D%29%2F+-path%3A.Rd&type=code Hence looking for an improvement directly by file.edit() rather than relying on its caller to do the check. OTOH, I first raised the issue thinking "oh we can just check Sys.which()", which turns out to be not so simple given file.edit()'s OS-dependent implementation/behavior. Therefore we might be best just ignoring this. Mike C On Sat, Dec 14, 2024 at 4:02 AM Dirk Eddelbuettel <e...@debian.org> wrote: > > > On 11 December 2024 at 15:00, Michael Chirico wrote: > | Thanks Simon, I didn't know that! That's definitely a compelling > | reason to leave the current default untouched and to eschew any > | finicky attempts to find back-up editors. > > I am not sure I agree with the fairly bold statement by Simon. I do not > install or use that many different Unix flavours but I do come across some > that do not, by default, install vi > > $ docker run --rm -ti debian bash > root@54d4be543766:/# vi > bash: vi: command not found > root@54d4be543766:/# > root@54d4be543766:/# nano > bash: nano: command not found > exit > $ > > Distributions may have defined sets of packages deemed 'essential', editors > do not seem to be part of that here. > > Anyway, when you are calling edit(), or call a function calling edit() you > can always override appropriately with both an environment variable or an R > option so this all seems like a nothingburger to me. "If on systems that > don't have all tools, maybe don't call functions from package `usethis`" > (which makes reasonable assumptions about what could be present) also seems > like a valid strategy. > > Dirk > > -- > dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel