[Rd] RFC: Different handling of commands from clipboard in Windows Re: [R] how to pause between plots running scripts?

Duncan Murdoch murdoch at stats.uwo.ca
Sun Nov 28 16:25:24 CET 2004

(Moved from r-help to r-devel)

Terry Mu pointed out that in Windows par(ask=T) works when a script is
sourced, but not when it is run from the script editor.  I think the
reason for this is that the script editor copies the selection to the
clipboard and then pastes it to the console.  When the console stops
to ask the user to hit Enter to continue, the next pasted line
satisfies the request, and things continue on.

This is also a problem with other cut and paste mechanisms:  if you
cut from an external editor and paste to the console, often you'd want
par(ask=T) to work, and you'd want a syntax error to abort the paste,

Finally, I find that sometimes (e.g. when updating a function
definition) I'd like to be able to do a "silent paste", where the code
is processed and executed, but it doesn't show in the console or the
history list.

We already have code to source() from the clipboard, and it could
address the problems above, but:

 - Source with echo=T doesn't echo, it deparses, so some comments are
lost, formatting is changed, etc.

 - Often I want to paste just part of an expression as I'm typing, so
source'ing from the clipboard wouldn't be what I wanted.  I'd need to
choose which kind of paste.  But we already have 3 ways to paste
(Paste, Paste commands only, Copy and Paste), and I'm reluctant to add
another option which could conceivably be used on all existing

Another approach would be to make the input routines smarter:  e.g.
clear the input buffer when there's a syntax error, suspend it when
asking for confirmation before the next graph:  but this looks
potentially really messy to me.

Another that deals only with the original graphics problem is to have 
par(ask=T) wait for input to the graphics window, rather than to the
console.  This has the advantage that the graphics window probably has
the focus, so a simple Enter there could satisfy it.

Or some other approach, or some combination of approaches.  


Duncan Murdoch

On Sat, 27 Nov 2004 22:38:34 -0500, Duncan Murdoch
<murdoch at stats.uwo.ca> wrote:

>>> > I used pause() from library(DAAG) to pasue between plots. This works
>>> > when I source a script, but seems don't work when I run (ctrl + R) the
>>> > script in R.
>This sounds like a bug to me, but I'm not sure it's going to be an
>easy one to fix.  
>Duncan Murdoch
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-devel mailing list