[rkward-cvs] [rkward] /: Fix parameter order and semantics in rk.edit.files()

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Dec 5 12:51:05 UTC 2014


Git commit 695395eeb0202cbfdbe9fbef7e28ab82005f024a by Thomas Friedrichsmeier.
Committed on 05/12/2014 at 12:50.
Pushed by tfry into branch 'master'.

Fix parameter order and semantics in rk.edit.files()

M  +1    -0    ChangeLog
M  +16   -15   rkward/rbackend/rpackages/rkward/R/rk.edit-functions.R
M  +6    -5    rkward/rbackend/rpackages/rkward/man/rk.edit.Rd

http://commits.kde.org/rkward/695395eeb0202cbfdbe9fbef7e28ab82005f024a

diff --git a/ChangeLog b/ChangeLog
index ceb6ba3..282d6c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+- Fixed: Error when using fix() or trace(...edit=TRUE) with default settings on some systems
 - When the RKWard installation has moved on disk, try to adjust stored .pluginmaps paths, accordingly
   - TODO: Actually test this on Windows
 - Fixed: Freezes when using RKWard-functionality (such as the RK()-device) from tcl/tk (e.g. Rcmdr)
diff --git a/rkward/rbackend/rpackages/rkward/R/rk.edit-functions.R b/rkward/rbackend/rpackages/rkward/R/rk.edit-functions.R
index 8e99cd8..c925384 100644
--- a/rkward/rbackend/rpackages/rkward/R/rk.edit-functions.R
+++ b/rkward/rbackend/rpackages/rkward/R/rk.edit-functions.R
@@ -6,11 +6,12 @@
 #' is edit asynchronously.
 #' 
 #' \code{rk.edit.files}, \code{rk.show.files}, and \code{rk.show.html} are
-#' equivalent to \link{file.edit}, \link{file.show}, and \link{browseURL},
+#' equivalent to \link{edit}, \link{file.show}, and \link{browseURL},
 #' respectively, but use RKWard as text/html editor/viewer. Generally it is
-#' recommended to use \link{file.edit}, \link{file.show}, and \link{browseURL},
-#' instead. These will call the respective RKWard functions by default, when
-#' run inside an RKWard session.
+#' recommended to use \link{edit}, \link{file.edit}, \link{file.show},
+#' and \link{browseURL}, instead. These will call the respective RKWard functions
+#' by default, when run inside an RKWard session. (via \code{getOption("editor")},
+#' and \code{getOption("browser")}.
 #' 
 #' @aliases rk.edit rk.edit.files rk.show.files rk.show.html
 #' @param x an object to edit.
@@ -45,18 +46,18 @@
 
 #' @export
 #' @rdname rk.edit
-"rk.edit.files" <- function (file = file, title = file, name = NULL, prompt = TRUE)
-{
-	if (!is.character (file)) {
-		nfile = tempfile()
-		env = environment (file)
-		dput (file, file=nfile, control=c ("useSource", "keepNA", "keepInteger", "showAttributes"))
-		.Call("rk.edit.files", nfile, title, name, prompt, PACKAGE="(embedding)")
-		x <- dget (nfile)
-		environment (x) <- env
-		return (x)
+"rk.edit.files" <- function (name=NULL, file="", title=NULL, prompt = TRUE) {
+	if (!is.null(name)) {
+		if (is.null (title)) title = deparse (substitute (name))
+		if (file == "") file = tempfile()
+		env = environment(name)
+		dput (name, file = file, control = c("useSource", "keepNA", "keepInteger", "showAttributes"))
+		.Call ("rk.edit.files", file, title, "", prompt, PACKAGE = "(embedding)")
+		x <- dget(file)
+		environment(x) <- env
+		return(x)
 	}
-	invisible (.Call ("rk.edit.files",  as.character (file),  as.character (title),  as.character (name), isTRUE (prompt), PACKAGE="(embedding)"))
+	invisible (.Call ("rk.edit.files", as.character (file), as.character (title), as.character (name), isTRUE (prompt), PACKAGE="(embedding)"))
 }
 
 #' @export
diff --git a/rkward/rbackend/rpackages/rkward/man/rk.edit.Rd b/rkward/rbackend/rpackages/rkward/man/rk.edit.Rd
index 9e796e9..458cbfa 100644
--- a/rkward/rbackend/rpackages/rkward/man/rk.edit.Rd
+++ b/rkward/rbackend/rpackages/rkward/man/rk.edit.Rd
@@ -8,7 +8,7 @@
 \usage{
 rk.edit(x)
 
-rk.edit.files(file = file, title = file, name = NULL, prompt = TRUE)
+rk.edit.files(name = NULL, file = "", title = NULL, prompt = TRUE)
 
 rk.show.files(file = file, header = file, title = NULL,
   delete.file = FALSE, prompt = TRUE, delete = delete.file)
@@ -45,11 +45,12 @@ is edit asynchronously.
 }
 \details{
 \code{rk.edit.files}, \code{rk.show.files}, and \code{rk.show.html} are
-equivalent to \link{file.edit}, \link{file.show}, and \link{browseURL},
+equivalent to \link{edit}, \link{file.show}, and \link{browseURL},
 respectively, but use RKWard as text/html editor/viewer. Generally it is
-recommended to use \link{file.edit}, \link{file.show}, and \link{browseURL},
-instead. These will call the respective RKWard functions by default, when
-run inside an RKWard session.
+recommended to use \link{edit}, \link{file.edit}, \link{file.show},
+and \link{browseURL}, instead. These will call the respective RKWard functions
+by default, when run inside an RKWard session. (via \code{getOption("editor")},
+and \code{getOption("browser")}.
 }
 \examples{
 ## Not run





More information about the rkward-tracker mailing list