[Sciviews-commits] r327 - komodo/SciViews-K/defaults

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 4 21:56:17 CEST 2010


Author: prezez
Date: 2010-10-04 21:56:17 +0200 (Mon, 04 Oct 2010)
New Revision: 327

Modified:
   komodo/SciViews-K/defaults/svStart.R
Log:
svStart.R: fixed problem in "getHelpUrl" when more then one topic is found, ".Rprofile" file is sourced after switching to working directory, added "self-destruction" of svStart on function exit.

Modified: komodo/SciViews-K/defaults/svStart.R
===================================================================
--- komodo/SciViews-K/defaults/svStart.R	2010-10-04 14:26:51 UTC (rev 326)
+++ komodo/SciViews-K/defaults/svStart.R	2010-10-04 19:56:17 UTC (rev 327)
@@ -37,12 +37,16 @@
 		}
 	}
 	file.create(lockfile)
-	on.exit(file.remove(lockfile)) # Clean up
+	on.exit({
+		file.remove(lockfile)
+		# Self-destruction
+		if(exists("svStart", envir = parent.frame(), inherits = TRUE))
+			rm("svStart", envir= parent.frame(), inherits = TRUE)
+		debugMsg("svStart exit")
+	}) # Clean up
 
 	if (debug) {
-		"debugMsg" <- function(...) {
-			cat("DEBUG:", ..., "\n")
-		}
+		"debugMsg" <- function(...) cat("DEBUG:", ..., "\n");
 	} else {
 		"debugMsg" <- function(...) {};
 	}
@@ -424,18 +428,28 @@
 				"/doc/html/index.html", sep = ""))
 		# I need to get the help file URL, but help() does not provide it any
 		# more! This is a temporary workaround for this problem
+
 		assignTemp("getHelpURL", function(x, ...) {
 			file <- as.character(x)
 			if (length(file) == 0) return("")
-			# Extension ".html" may be missing 
+			# Extension ".html" may be missing
 			htmlfile <- basename(file)
-			if(substring(htmlfile, nchar(htmlfile) -4) != ".html")
-				htmlfile <- paste(htmlfile, ".html", sep="")
-			return(paste("http://127.0.0.1:", tools:::httpdPort,
-			"/library/", basename(dirname(dirname(file))),
-			"/html/", htmlfile, sep = ""))
+
+			if(length(file) > 1) {
+				# If more then one topic is found
+				paste("http://127.0.0.1:", tools:::httpdPort,
+					"/library/NULL/help/", attr(x,"topic"), sep = "")
+			} else {
+				if(substring(htmlfile, nchar(htmlfile) -4) != ".html")
+					htmlfile <- paste(htmlfile, ".html", sep="")
+				return(paste("http://127.0.0.1:", tools:::httpdPort,
+				"/library/", basename(dirname(dirname(file))),
+				"/html/", htmlfile, sep = ""))
+			}
 		})
 
+
+
 # print method of object returned by help() is very unflexible for R.app and
 # does not allow in any way to use anything else than the R.app internal
 # browser for help!!!
@@ -522,11 +536,14 @@
 		}
 		# Update info in Komodo:
 		debugMsg("Contacting Komodo with koCmd")
-		invisible(koCmd("sv.socket.updateCharset();"))
-		invisible(koCmd("sv.cmdout.append('R is started');"))
-		invisible(koCmd("sv.command.updateRStatus(true);"))
+		invisible(koCmd(paste(
+			"sv.socket.rUpdate()",
+			"sv.cmdout.append('R is started')",
+			"sv.command.updateRStatus(true)",
+			sep=";")))
+	}
 
-	}
+	if(file.exists(".Rprofile"))	source(".Rprofile")
 	return(invisible(res))
 }
 ### SciViews install end ###



More information about the Sciviews-commits mailing list