[ESS] Pause between startup commands

Martin Maechler maechler at stat.math.ethz.ch
Wed Aug 23 11:44:25 CEST 2006


>>>>> "DavidB" == Brahm, David <David.Brahm at geodecapital.com>
>>>>>     on Tue, 22 Aug 2006 15:53:07 -0400 writes:

    DavidB> When I start up ESS 5.3.1, I get:
    >> if(!exists("baseenv", mode="function")) baseenv <- function() NULL
    DavidB> options(STERM='iESS', editor='emacsclient')
    >> > 

    DavidB> A little ugly, as the two commands run together.  

well, yes,...  {we never felt a need to consider a patch,
	        now that you bring it up with a patch proposal
	        makes it a different story}

    DavidB> A brief pause between commands would fix this up:

    >> if(!exists("baseenv", mode="function")) baseenv <- function() NULL
    >> options(STERM='iESS', editor='emacsclient')
    >> 

    DavidB> That pause can be achieved by adding
    DavidB> (sleep-for 0.1)
    DavidB> after line 142 in essd-r.el, i.e. after the "baseenv" text and
    DavidB> before the (if inferior-ess-language-start ...) line.

I tried that (exactly as you said), and it does help
but only for that particular case, and in my case,
I also have  several "...-screen-options" that are executed and so,
even after your proposal, I get

> options(editor = "emacsclient")
options(width=80,length=99999)
if(!exists("baseenv", mode="function")) baseenv <- function() NULL
> > > options(STERM='iESS', editor='emacsclient')
> 

and many such cases of lines sent too fast and  "> > ..."  are
known to happen in similar cases. 
I think the reason is that emacs has become too fast :-)
The crucial function is 
 (ess-eval-linewise .)
defined in lisp/ess-inf.el
and there I think it's (line 1009):

 	   (accept-process-output nil 0 100)
				      ^^^^^
where the '0 100' means {0 second + 100 milliseconds} which we
wait before continuing anyway.

Of course one could increase the 100 and then maybe get better
"prompt reflectance" in ESS - but I assume it would be for the
cost of slowing down some operations.

In any case, I think we could (and should) make the '100' above
into a new optional argument of (ess-eval-linewise .)
where the arguments defaults to a new customizable variable,
so users can easily experiment.
If anyone has time to provide a patch, please use the source at
https://svn.R-project.org/ESS/trunk/lisp/

Do you want to try?

Martin




More information about the ESS-help mailing list