richcalaway at revolution-computing.com
2009-Aug-31 23:45 UTC
[Rd] setRepositories() doesn't allow graceful cancellation from GUI menu (PR#13937)
Full_Name: Richard Calaway Version: 2.9.2 OS: Windows Vista Submission from: (NULL) (65.47.30.18) If you call setRepositories(graphics=TRUE), or, equivalently, choose "Select repositories..." from RGui's Packages menu, and then click "Cancel", you are dropped to the command line menu. Choosing "Cancel" should drop you back to the top-level prompt. Also, the command-line menu doesn't specify how to cancel. The following patch clears up both problems: Index: packages.R ==================================================================--- packages.R (revision 49504) +++ packages.R (working copy) @@ -639,7 +639,7 @@ } default <- a[["default"]] - + nc <- length(default) if(length(ind)) res <- as.integer(ind) else { res <- integer(0L) @@ -654,20 +654,19 @@ multiple = TRUE, "Repositori es"), a[, 1L]) } - if(!length(res)) { + else { ## text-mode fallback cat(gettext("--- Please select repositories for use in this session ---\n")) - nc <- length(default) cat("", paste(seq_len(nc), ": ", ifelse(default, "+", " "), " ", a[, 1L], sep=""), "", sep="\n") - cat(gettext("Enter one or more numbers separated by spaces\n")) + cat(gettext("Enter one or more numbers separated by spaces, or 0 to cancel\n")) res <- scan("", what=0, quiet=TRUE, nlines=1L) - if(!length(res) || (length(res) == 1L && !res[1L])) - return(invisible()) - res <- res[1 <= res && res <= nc] } + if(!length(res) || (length(res) == 1L && !res[1L])) + return(invisible()) + res <- res[1 <= res && res <= nc] } if(length(res)) { repos <- a[["URL"]]
Seemingly Similar Threads
- FW: RE: Bug 13937 (setRepositories() doesn't allow graceful cancellation from GUI menu) (PR#13969)
- Vignette using parallel's makeCluster function has trouble building on Windows 7
- utils::setRepositories bug when adding a local repository? (PR#7810)
- motivation for setRepositories and chooseCRANmirror
- xy.coords assumes lists will have x and y components, but doesn't check (PR#13936)