#26 2.6.3 connects to already-active sessions rather than initiating its own

version 2.1
closed-rejected
nobody
None
5
2014-06-09
2014-06-06
Anthony Damico
No

npptor 2.6.2 would initiate its own, independent 64-bit R session in SDI mode.

i upgraded to 2.6.3 and suddenly it is connecting to whatever R session was most recently used, and those other R sessions might be in MDI mode which causes other problems.

how do we get it to always start its own session? i'm confused why this changed with the upgrade :/

Discussion

  • Andrew Redd
    Andrew Redd
    2014-06-06

    Just start a new session. I include a definition in my R profile for spawnR() which opens a new instance of R.

    This is due to an improvement in finding running R windows and not a bug. The infrastructure of NppToR as it currently stands does not allow for 'remembering' which session is is attached to. It always connects to the most recently used session. The improvement made so that it can sometimes connect to MDI windows, but as mentioned in bug #25 NppToR is not supported in MDI mode, and I will not fix bugs that relate to MDI mode. If anyone would like to submit patches for MDI mode bugs I'm willing to consider them.

     
  • Andrew Redd
    Andrew Redd
    2014-06-06

    • status: open --> closed-rejected
     
  • Anthony Damico
    Anthony Damico
    2014-06-06

    npptor has always "remembered" which session it was attached to in the past. is there a way to turn off this "improvement"? it's much nicer to have npptor start its own session and ignore all the others forever. :/

    could you also share the relevant lines of your R profile? google results are flooded with movie quotes and the only relevant package looks like a lot of work for what probably is a line of code you already have?

     
  • Andrew Redd
    Andrew Redd
    2014-06-06

    It used to be that NppToR would altogether ignore the Rgui windows and as such would ignore the R Console sub window, because search was by type. Now NppToR searches by window class which is more reliable, but it also means that it can detect console windows that are subwindows of MDI Rgui windows.

    Here is my definition of spawnR:

    spawnR <- function(wd=getwd(), restore=FALSE, save=FALSE, vanilla=FALSE){
    if(!missing(wd) && wd != getwd()){
    old.dir <- getwd()
    on.exit(setwd(old.dir))
    setwd(wd)
    }
    args <- character(0)
    if(!restore) args <- c(args, '--no-restore')
    if(vanilla) args <- c(args, '--vanilla')
    if(!save) args <- c(args, '--no-save')
    system2(file.path(R.home("bin"), "Rgui.exe"), args
    , wait=F, stdout=FALSE, stderr=FALSE, invisible=FALSE)
    }

    I allways run in SDI mode but you might want to include an option for that as well.