[Rd] Help please: please test timestamping of command history

Martin Maechler
Mon, 27 Mar 2006 06:47:38 -0000

[from a semi-private diversion of the R-devel thread ]

>>>>> "Duncan" == Duncan Murdoch <murdoch at
stats.uwo.ca>
>>>>>     on Sat, 25 Mar 2006 12:28:30 -0500 writes:

    Duncan> On 3/25/2006 11:30 AM, Martin Maechler wrote:
    >> Hi Duncan,
    >>
    >> I think all ESS users don't use history() because ESS
    >> calls R with "--no-readline" (Unix) or "--ess"
(Windows &
    >> Cygwin)
    >>
    >> I'd wish that in that case, and probably also in BATCH
    >> mode, timestamp() should write the time stamp prefixed by
    >> "##" to the "R console" (to R's stdout);
when people are
    >> using ESS properly, then rather than wanting a history,
    >> they save the R's buffer ("*R*") as "R
transcript" (file
    >> typically ending with ".Rt" or ".Rout") and it
makes much
    >> sense to have a time stampe entry in that file when
    >> others would want an entry in the history.

    Duncan> Thanks, that's a good suggestion.  Do you know what
    Duncan> the test is for this state, in either R or C code?
    Duncan> capabilities() doesn't do it.  Does ESS make itself
    Duncan> known to R code somehow?

Yes, when ESS starts  R (or S+) , it also issues

  options(STERM='iESS')

and we (ESS core) thought that other GUIs / IDEs ideally should
also set "STERM"  - which AFAIK hasn't been adopted widely.

hence   if ( identical("iESS", getOption("STERM")) )  {
	   ## are running 'inside ESS'
        }

should be pretty reliable.

Martin