On 17 December 2021 at 21:13, Patrice Kiener wrote:
| Thank you for your suggestions. Let's give more details. The idea is to 
| insert the code in a function and then in a (private) package. We have 
| to rely on the default editors provided by the OS to R and cannot invent 
| a new editor, as R CMD check could fail on exotic platforms. We cannot 
| assume that Geany, even nano, is available everywhere.

But you can (and likely: should !!) test for their presence via
Sys.which(prog):

    > Sys.which("vi")
               vi 
    "/usr/bin/vi" 
    > Sys.which("notExisting")
    notExisting 
             "" 
    > 

In short, you have no guarantee that what is EDITOR is actually sane!

| The instruction for the text editor
| 
|   system2(getOption("editor"), fileREP, wait = FALSE)
| 
| works fine on Windows (it opens Notepad.exe, or Notepad++.exe in my 
| Rprofile.site) but not on Unix. I assumed there was something similar on 
| Unix (You have understood that I am not a Unix specialist). R includes a 

As Ivan was hinted this gets more complicated with apps being launched
synchronousy or asynchronously.

What you are after is actually a hard problem, portably, across OSs.

Dirk

-- 
https://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

_______________________________________________
R-SIG-Debian mailing list
R-SIG-Debian@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-debian

Reply via email to