[Sciviews-commits] r514 - komodo/SciViews-K/udl pkg/svDoc pkg/svDoc/inst/asciidoc pkg/svMisc pkg/svMisc/R pkg/svSweave/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 24 21:04:07 CET 2013


Author: phgrosjean
Date: 2013-01-24 21:04:06 +0100 (Thu, 24 Jan 2013)
New Revision: 514

Modified:
   komodo/SciViews-K/udl/wikilex.udl
   pkg/svDoc/TODO
   pkg/svDoc/inst/asciidoc/asciidoc.conf
   pkg/svMisc/DESCRIPTION
   pkg/svMisc/NEWS
   pkg/svMisc/R/TempEnv.R
   pkg/svMisc/R/addItems.R
   pkg/svMisc/R/argsTip.R
   pkg/svMisc/R/batch.R
   pkg/svMisc/R/callTip.R
   pkg/svMisc/R/captureAll.R
   pkg/svMisc/R/completion.R
   pkg/svMisc/R/def.R
   pkg/svMisc/R/descFun.R
   pkg/svMisc/R/fileEdit.R
   pkg/svMisc/R/getEnvironment.R
   pkg/svMisc/R/guiCmd.R
   pkg/svMisc/R/helpSearchWeb.R
   pkg/svMisc/R/isHelp.R
   pkg/svMisc/R/isSDI.R
   pkg/svMisc/R/listTypes.R
   pkg/svMisc/R/objBrowse.R
   pkg/svMisc/R/objClear.R
   pkg/svMisc/R/objList.R
   pkg/svMisc/R/parseText.R
   pkg/svMisc/R/pkg.R
   pkg/svMisc/R/rjson.R
   pkg/svMisc/R/rmTemp.R
   pkg/svMisc/R/sourceClipboard.R
   pkg/svMisc/R/systemFile.R
   pkg/svMisc/R/tempvar.R
   pkg/svSweave/R/tangleLyxRnw.R
   pkg/svSweave/R/weaveLyxRnw.R
Log:
Lot of small changes in svMisc + further work on svSweave/svDoc and R wiki syntax intelligence

Modified: komodo/SciViews-K/udl/wikilex.udl
===================================================================
--- komodo/SciViews-K/udl/wikilex.udl	2013-01-12 11:28:08 UTC (rev 513)
+++ komodo/SciViews-K/udl/wikilex.udl	2013-01-24 20:04:06 UTC (rev 514)
@@ -75,7 +75,7 @@
 '##': paint(upto, M_CDATA), paint(include, M_COMMENT), => in_wiki_have_comment
 
 # This is for the item list
-'- ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+# NO'- ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
 '* ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
 '** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
 '*** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
@@ -88,7 +88,7 @@
 '... ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
 '.... ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
 '..... ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
-/[1-9]\. /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+/[1-9][0-9]?\. /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
 /[a-z]\. /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
 /[A-Z]\. /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
 /[ivx]+\) /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
@@ -126,9 +126,7 @@
 # Line break with +
 / \+$/: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_start_of_line
 /$/: => in_wiki_default_start_of_line
-# We don't want to transit to italic stage for URLs like http://xxx
-"://": #stay
-"//" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_italic
+",," : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_italic
 "**" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_bold
 ## TODO: use a different language here... may be latex or latexequation?
 "+++$$" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_equation
@@ -193,10 +191,9 @@
 #{{{ in-line things
 state in_wiki_italic:
 # We don't want to transit from italic stage for URLs like http://xxx
-"://": #stay
-/!\/+/: #stay
+/!,,/: #stay
 ## TODO: allow for other in-line things inside this!
-"//" : paint(upto, M_ATTRNAME), paint(include, M_TAGNAME), => in_wiki_default_on_line
+",," : paint(upto, M_ATTRNAME), paint(include, M_TAGNAME), => in_wiki_default_on_line
 
 state in_wiki_bold:
 /!\**/: #stay

Modified: pkg/svDoc/TODO
===================================================================
--- pkg/svDoc/TODO	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svDoc/TODO	2013-01-24 20:04:06 UTC (rev 514)
@@ -1,5 +1,45 @@
 = svDoc - To do list
 
+* Add and support a syntax for line break (and page break?)
+
+* Check styles for paragraphs
+
+* Change syntax for onm code
+
+* Use only one # at the beginning of a line for wiki comments???
+
+* Numbered figures, tables, equations and listings
+
+* Check syntax highlighting for image:filename[caption] and image::filename[caption]
+
+* Check target, link, and link to external files for syntax
+
+* Support for equal signs at the end of titles too
+
+* Support for block elements, including listing, litera, sidebar, quote, example
+  with styles
+  
+* Full support for table formatting
+
+* &&&1+1&&& for inline R expression \Sexpr{...}.
+
+* Support for special inline stiles like variable, code, package, command,
+   menu item, file, program
+
+* Support for replacepent for R, SciViews, LyX, LaTeX, ...
+
+* Support for level 1 & 2 undelined titles (=== and ---, respectively)
+
+* Support for horizontal line => ???
+
+* Support for include::filename[]
+
+* Something else for italic than //italic//
+
+* Support for ((footnote)) instead of footnote:[footnote text]
+
+* Check support for labelled lists using ::, ;;, :::, :::: (:::::)?
+
 * Use format provided by the svDoc header, if not provided
 
 * Allow compiling docs without #! and/or svDoc::header()!

Modified: pkg/svDoc/inst/asciidoc/asciidoc.conf
===================================================================
--- pkg/svDoc/inst/asciidoc/asciidoc.conf	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svDoc/inst/asciidoc/asciidoc.conf	2013-01-24 20:04:06 UTC (rev 514)
@@ -22,7 +22,7 @@
 # Uncomment to use xhtml11 quirks mode CSS.
 #quirks=
 # HTML source code highlighter (source-highlight, pygments or highlight).
-source-highlighter=source-highlight
+source-highlighter=highlight
 # Uncomment to use deprecated quote attributes.
 #deprecated-quotes=
 empty=
@@ -88,7 +88,7 @@
 #$$=#unquoted
 $$=monospaced
 ~~=#monospaced
-//=#emphasis
+,,=#emphasis
 #//=emphasis
 ##\##=#unquoted
 ##\#=unquoted
@@ -106,49 +106,49 @@
 # strips the backslash from the escaped replacement.
 
 # (C) Copyright (entity reference ©)
-(?<!\\)\(C\)=©
-\\\(C\)=(C)
+#(?<!\\)\(C\)=©
+#\\\(C\)=(C)
 
 # (R) registered trade mark (entity reference ®
-(?<!\\)\(R\)=®
-\\\(R\)=(R)
+#(?<!\\)\(R\)=®
+#\\\(R\)=(R)
 
 # (TM) Trademark (entity reference ™)
-(?<!\\)\(TM\)=™
-\\\(TM\)=(TM)
+#(?<!\\)\(TM\)=™
+#\\\(TM\)=(TM)
 
 # -- Spaced and unspaced em dashes (entity reference —).
 # Space on both sides is translated to thin space characters.
-(^-- )=— 
-(\n-- )|( -- )|( --\n)= — 
-(\w)--(\w)=\1—\2
-\\--(?!-)=--
+#(^-- )=— 
+#(\n-- )|( -- )|( --\n)= — 
+#(\w)--(\w)=\1—\2
+#\\--(?!-)=--
 
 # Replace vertical typewriter apostrophe with punctuation apostrophe.
-(\w)'(\w)=\1’\2
-(\w)\\'(\w)=\1'\2
+#(\w)'(\w)=\1’\2
+#(\w)\\'(\w)=\1'\2
 
 # ... Ellipsis (entity reference …)
-(?<!\\)\.\.\.=…
-\\\.\.\.=...
+#(?<!\\)\.\.\.=…
+#\\\.\.\.=...
 
 # Arrows from the Arrows block of Unicode.
 # -> right arrow
-(?<!\\)->=→
-\\->=->
+#(?<!\\)->=→
+#\\->=->
 # => right double arrow
-(?<!\\)\=>=⇒
-\\\=>==>
+#(?<!\\)\=>=⇒
+#\\\=>==>
 # <- left arrow
-(?<!\\)<-=←
-\\<-=<-
+#(?<!\\)<-=←
+#\\<-=<-
 # <= left double arrow
-(?<!\\)<\==⇐
-\\<\==<=
+#(?<!\\)<\==⇐
+#\\<\==<=
 
 # Arbitrary entity references.
-(?<!\\)&([:_#a-zA-Z][:_.\-\w]*?;)=&\1
-\\(&[:_#a-zA-Z][:_.\-\w]*?;)=\1
+#(?<!\\)&([:_#a-zA-Z][:_.\-\w]*?;)=&\1
+#\\(&[:_#a-zA-Z][:_.\-\w]*?;)=\1
 
 #-----------
 # Paragraphs

Modified: pkg/svMisc/DESCRIPTION
===================================================================
--- pkg/svMisc/DESCRIPTION	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/DESCRIPTION	2013-01-24 20:04:06 UTC (rev 514)
@@ -1,7 +1,7 @@
 Package: svMisc
 Type: Package
 Version: 0.9-67
-Date: 2012-07-07
+Date: 2013-01-21
 Title: SciViews GUI API - Miscellaneous functions
 Authors at R: c(person("Philippe", "Grosjean", role = c("aut", "cre"),
   email = "phgrosjean at sciviews.org"),

Modified: pkg/svMisc/NEWS
===================================================================
--- pkg/svMisc/NEWS	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/NEWS	2013-01-24 20:04:06 UTC (rev 514)
@@ -4,7 +4,12 @@
 
 * Added the fileEdit() function.
 
+* Reworked argsTip() function to eliminate old code (for R < 2.10).
 
+* parseText() reported an error instead of NA in the case last string is
+  incomplete in R 2.15.
+
+
 == Changes in svMisc 0.9-66
 
 * Added function isJGR().

Modified: pkg/svMisc/R/TempEnv.R
===================================================================
--- pkg/svMisc/R/TempEnv.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/TempEnv.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -7,5 +7,5 @@
         rm(TempEnv)
         pos <- match("TempEnv", search())
     }
-    return(pos.to.env(pos))
+    pos.to.env(pos)
 }

Modified: pkg/svMisc/R/addItems.R
===================================================================
--- pkg/svMisc/R/addItems.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/addItems.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -6,7 +6,7 @@
 	} else {
 		res <- sort(unique(res))
 	}
-	return(res)
+	res
 }
 
 addActions <- function (obj = ".svActions", text = NULL, code = NULL,
@@ -36,7 +36,7 @@
 
 	## Reassign the modified values
 	assignTemp(obj, dat)
-	return(invisible(dat))
+	invisible(dat)
 }
 
 addIcons <- function (obj = ".svIcons", icons, replace = TRUE)
@@ -61,7 +61,7 @@
 
 	## Reassign the modified values
 	assignTemp(obj, icn)
-	return(invisible(icn))
+	invisible(icn)
 }
 
 addMethods <- function (methods)
@@ -70,5 +70,5 @@
 	met <- getOption("svGUI.methods")
 	if (!is.null(met)) methods <- addItems(met, methods, use.names = FALSE)
 	options(svGUI.methods = sort(methods))
-	return(invisible(methods))
+	invisible(methods)
 }

Modified: pkg/svMisc/R/argsTip.R
===================================================================
--- pkg/svMisc/R/argsTip.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/argsTip.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -22,5 +22,5 @@
 	## Reflow the tip
 	if (!is.null(width))
 		res <- paste(strwrap(res, width = width, exdent = 4), collapse = "\n")
-	return(res)
+	res
 }

Modified: pkg/svMisc/R/batch.R
===================================================================
--- pkg/svMisc/R/batch.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/batch.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -1,12 +1,5 @@
-batch <- function (  # A test batch process...
-	### This batch process runs fakeProc() on ten files,
-	### we want a complete and readable log of the whole process at the end!
-items,	##<< a list of items to process with \code{fun}
-fun,	##<< the function to be run in batch mode
-...,	##<< further arguments passed to the process function
-show.progress = !isAqua() && !isJGR(),	##<< whether we display a progression message
-suppress.messages = show.progress,	##<< do we suppress simple messages?
-verbose = TRUE)	##<< display start and end messages
+batch <- function (items, fun, ...,	show.progress = !isAqua() && !isJGR(),
+suppress.messages = show.progress, verbose = TRUE)
 {
 	if (!is.function(fun)) stop("'fun' must be a function")
 	
@@ -27,7 +20,7 @@
 	if (!isTRUE(as.logical(show.progress)))
 		progress <- function (...) return() # Fake progress() function
 	if (!isTRUE(as.logical(suppress.messages)))
-		suppressMessages <- function (x) return(x) # Fake suppressMessages() function
+		suppressMessages <- function (x) return(x) # Fake suppressMessages() fun
 	
 	## Run fun() for each item
 	flush.console()
@@ -43,7 +36,5 @@
 	## Record .last.batch variable in TempEnv
 	lastBatch <- structure(sum(ok, na.rm = TRUE) == n, items = items, ok = ok)
 	assignTemp(".last.batch", lastBatch)
-	return(invisible(lastBatch))
-	### returns invisibly \code{TRUE} if all files were processed succesfully,
-	### otherwise, return \code{FALSE} invisibly
+	invisible(lastBatch)
 }

Modified: pkg/svMisc/R/callTip.R
===================================================================
--- pkg/svMisc/R/callTip.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/callTip.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -63,5 +63,5 @@
 				sep = "")
 		}
 	}
-	return(ctip)
+	ctip
 }

Modified: pkg/svMisc/R/captureAll.R
===================================================================
--- pkg/svMisc/R/captureAll.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/captureAll.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -1,7 +1,8 @@
 ## Inspired by 'capture.output' and utils:::.try_silent
 ## Requires: R >= 2.13.0 [??]
-`captureAll` <- function (expr, split = TRUE, echo = TRUE, file = NULL,
-markStdErr = FALSE) {
+captureAll <- function (expr, split = TRUE, echo = TRUE, file = NULL,
+markStdErr = FALSE)
+{
 	if (!is.expression(expr))
 		if (is.na(expr)) return(NA) else
 		stop("expr must be an expression or NA")

Modified: pkg/svMisc/R/completion.R
===================================================================
--- pkg/svMisc/R/completion.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/completion.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -4,8 +4,8 @@
 addition = FALSE, skip.used.args = TRUE, sep = "\n", type.sep = "?")
 {
 	.Deprecated("completion")
-	return(completion(code, print = print, types = types, addition = addition,
-		skip.used.args = skip.used.args, sep = sep, field.sep = type.sep))
+	completion(code, print = print, types = types, addition = addition,
+		skip.used.args = skip.used.args, sep = sep, field.sep = type.sep)
 }
 
 CompletePlus <- function (linebuffer, cursorPosition = nchar(linebuffer),
@@ -278,7 +278,7 @@
 	## Finalize processing of the completion list
 	funargs <- ComplEnv$funargs
 	isFirstArg <- ComplEnv$isFirstArg
-	return(finalize(completions))
+	finalize(completions)
 }
 
 .reserved.words <- c("if", "else", "repeat", "while", "function", "for", "in",
@@ -293,7 +293,7 @@
 
 ## Modified utils:::inFunction()
 ## (checked equivalent with R 2.11.1)
-## The only difference is that it also gets current arguments list (if applicable).
+## Only difference: it also gets current arguments list (if applicable).
 ## They are assigned to utils:::.CompletionEnv$funargs
 .inFunctionExt <-
 function (line = utils:::.CompletionEnv[["linebuffer"]],
@@ -450,5 +450,5 @@
         if (all(out != "")) break
     }
     names(out) <- what
-    return(sub("^package:", "", out))
+    sub("^package:", "", out)
 }

Modified: pkg/svMisc/R/def.R
===================================================================
--- pkg/svMisc/R/def.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/def.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -1,12 +1,12 @@
 def <- function (value, default = "", mode = "character", length.out = NULL)
 {
 	## Ensure we got a value of a given mode, and if not, use default
-	## If length.out is provided, make sure that the returned vector has that length
-	## (if needed, cut or recycle 'value')
+	## If length.out is provided, make sure that the returned vector has
+	## that length (if needed, cut or recycle 'value')
 
 	## If either NULL or something of length == 0 is in 'value', then,
 	## return default
-	if (is.null(value) || length(value) == 0) value <- default
+	if (!length(value)) value <- default
 
 	## Coerce to mode...
 	res <- switch(as.character(mode[1]),
@@ -26,5 +26,5 @@
 			length.out <- round(as.numeric(length.out[1]))
 		res <- rep(res, length.out = length.out)
 	}
-	return(res)
+	res
 }

Modified: pkg/svMisc/R/descFun.R
===================================================================
--- pkg/svMisc/R/descFun.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/descFun.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -1,65 +1,9 @@
 descFun <- function (fun, package, lib.loc = NULL)
 {
-	if (missing(package)) package <- NULL
-	
-	## Use the new help system if this is R >= 2.10.0
-	if (compareRVersion("2.10.0") >= 0)
-		return(.descFunNew(fun = fun, package = package, lib.loc = lib.loc))
-	
-	## Otherwise, use the old version (that depends on text rendered help files)
-	if (is.null(fun) || length(fun) == 0) return("")
+	if (!length(fun)) return("")
 	fun <- as.character(fun)
-	package <- rep(package, length.out = length(fun))
-	## Get the description associated with this topic
-	AllTopics <- eval(parse(text = paste("library(help =", package,
-		")")))$info[[2]]
-	if (length(AllTopics) == 0) return("")
-	res <- character()
-	for (i in 1:length(fun)) {
-		## index.search() will not be visible any more and will have different
-		## arguments in R 2.11... and it is DEPRECATED in R 2.10
-		## => need to use a different code here!!!
-		## This is a temporary hack for svMisc to pass R CMD check on these versions
-		if (!exists("index.search", mode= "function"))
-			index.search <- function (...) return("")
-		paths <- sapply(.find.package(package, lib.loc, verbose = FALSE),
-			function(p) index.search(fun[i], p, "AnIndex", type = "help"))
-		## Topic is the entry that contains the description
-		Topic <- basename(paths[paths != ""])[1]
-		## Get the first line of the description
-		FirstLine <- (1:length(AllTopics))[regexpr(paste("^", Topic, " ",
-			sep = ""), AllTopics) > -1]
-		## If not found, try with fun[i]
-		if (length(FirstLine) == 0) {
-			Topic <- fun[i]
-			FirstLine <- (1:length(AllTopics))[regexpr(paste("^", Topic, " ",
-				sep = ""), AllTopics) > -1]
-		}
-		if (length(FirstLine) == 0) {
-			res[i] <- ""  # Not found (should never happen?)
-		} else {
-			## Eliminate everything before this line
-			Topics <- AllTopics[FirstLine[1]:length(AllTopics)]
-			## We may have several lines of description: keep them all
-			isSpace <- (regexpr("^ ", Topics) == -1)
-			isDesc <- (cumsum(isSpace) == 1)
-			Topics[1] <- sub(paste("^", Topic, sep = ""), "", Topics[1])
-			## Get the description and return it
-			res[i] <- paste(sub("^ +", "", Topics[isDesc]), collapse = " ")
-		}
-	}
-	## Add names to this vector and return it
-	names(res) <- fun
-	return(res)
-}
-
-.descFunNew <- function (fun, package, lib.loc = NULL)
-{
-	## Get the description of fun using the new (R >= 2.10.0) help system
-	if (is.null(fun) || length(fun) == 0) return("")
-	fun <- as.character(fun)
 	l <- length(fun)
-	if (is.null(package)) package <- ""
+	if (missing(package) || is.null(package)) package <- ""
 	package <- rep(package, length.out = l)
 	
 	## Create a vector of results
@@ -89,94 +33,10 @@
 			}
 		}
 	}
-	return(res)
+	res
 }
 
 descArgs <- function (fun, args = NULL, package = NULL, lib.loc = NULL)
-{
-	## Use the new help system if this is R >= 2.10.0
-	if (compareRVersion("2.10.0") >= 0)
-		return(.descArgsNew(fun = fun, args = args, package = package,
-			lib.loc = lib.loc))
-	
-	## Otherwise, use the old version (that depends on text rendered help files)
-	
-	## Start from the text version of the online help instead of the .Rd file
-	## The next line is to avoid raising warnings in R CMD check in R >= 2.10
-	hlp <- function (...) help(...)
-	if (is.null(package)) {
-		File <- as.character(hlp(fun,
-			lib.loc = lib.loc, chmhelp = FALSE, htmlhelp = FALSE))
-	} else {
-		File <- as.character(hlp(fun, package = parse(text = package),
-			lib.loc = lib.loc, chmhelp = FALSE, htmlhelp = FALSE))
-	}
-	if (length(File) == 0) return(character(length(args)))
-
-	## Doing the same as help to extract the file if it is in a zip
-	File <- zip.file.extract(File, "Rhelp.zip")
-
-	## If the file could not be extracted, return empties
-	if( !file.exists(File))
-		return(rep("", length(args)))
-	
-	## Guess the encoding (from print.help_files_with_topic)
-	first <- readLines(File, n = 1)
-	enc <- if (length(grep("\\(.*\\)$", first)) > 0) {
-		sub("[^(]*\\((.*)\\)$", "\\1", first)
-	} else ""
-	if (enc == "utf8") enc <- "UTF-8"
-	if (.Platform$OS.type == "windows" && enc == "" &&
-		l10n_info()$codepage < 1000)
-		enc <- "CP1252"
-	File. <- file(File, encoding = enc, open = "r")
-
-	## Read content of the text file
-	Data <- scan(File., what = character(), sep = "\n", quiet = TRUE)
-	close(File.)
-
-	## Get the Arguments: section
-	argsStart <- (1:length(Data))[Data == "_\bA_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs:"]
-	if (length(argsStart) == 0)	 # Not found
-		return(rep("", length(args)))
-	## Eliminate everything before this section
-	Data <- Data[(argsStart[1] + 1):length(Data)]
-	## Check where next section starts
-	nextSection <- suppressWarnings((1:length(Data))[regexpr("^_\\b", Data) > -1])
-	if (length(nextSection) > 0)  # Cut everything after this section
-		Data <- Data[1:(nextSection[1] - 1)]
-	## Split description by arguments, like: "^ *argument[, argument]: " + desc
-	argsFirstLine <- regexpr("^ *[a-zA-Z0-9_., ]+: .*$", Data) > -1
-	argsNames <- sub("^ *([a-zA-Z0-9_., ]+): .*$", "\\1", Data[argsFirstLine])
-	## Try to detect false argsNames, when ":" occurs in description
-	isArgs <- (regexpr("[^,] ", argsNames) == -1)
-	argsFirstLine[argsFirstLine] <- isArgs
-	argsNames <- argsNames[isArgs]
-	## Get the argument description
-	argsDesc <- sub("^ *(.*)$", "\\1", Data)
-	argsDesc[argsFirstLine] <- sub("^[a-zA-Z0-9_., ]+: (.*)$", "\\1",
-		argsDesc[argsFirstLine])
-	## Create a character vector with the successive argument descriptions
-	res <- tapply(argsDesc, cumsum(argsFirstLine), paste, collapse = " ")
-	res <- as.vector(res)
-	## Create multiple entries for "arg1, arg2, ..."
-	argsNames <- strsplit(argsNames, ", *")
-	Times <- sapply(argsNames, length)
-	res <- rep(res, Times)
-	names(res) <- unlist(argsNames)
-	## If args is not NULL, filter according to provided arguments
-	if (!is.null(args)) {
-		res <- res[as.character(args)]
-		## If arg names do not exists, return NA -> replace by ""
-		names(res) <- args
-		res[is.na(res)] <- ""
-	}
-	return(res)
-}
-
-## Version of descArgs for R >= 2.10.0 and its new help system
-## TODO: eliminate multispaces in the returned strings!
-.descArgsNew <- function (fun, args = NULL, package = NULL, lib.loc = NULL)
 {	
 	## We cannot just call help normally because otherwise it thinks
 	## we are looking for package "package" so we create a call and eval it

Modified: pkg/svMisc/R/fileEdit.R
===================================================================
--- pkg/svMisc/R/fileEdit.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/fileEdit.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -166,7 +166,7 @@
 			Sys.sleep(0.3)         # Wait for 0.3 sec
 		}
 	}
-	return(invisible(editor))
+	invisible(editor)
 } 
 
 .fileEditRgui <- function (file, title = file, wait = FALSE) 
@@ -202,5 +202,5 @@
 			Sys.sleep(0.3)         # Wait for 0.3 sec
 	}
 
-	return(invisible(editor))
+	invisible(editor)
 } 

Modified: pkg/svMisc/R/getEnvironment.R
===================================================================
--- pkg/svMisc/R/getEnvironment.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/getEnvironment.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -4,5 +4,5 @@
 	## Retrieve an environment from a position in search(), or from its name
 	## if pos = -1, returns the parent environment of the calling function
 	envir <- if (pos == -1) parent.frame(2) else as.environment(pos)
-	return(envir)
+	envir
 }

Modified: pkg/svMisc/R/guiCmd.R
===================================================================
--- pkg/svMisc/R/guiCmd.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/guiCmd.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -9,41 +9,41 @@
 guiLoad <- function (...)
 {
 	## Ask the GUI client to select a .Rdata file to load()
-	return(guiCmd("load", ...))
+	guiCmd("load", ...)
 }
 
 guiSource <- function (...)
 {
 	## Ask the GUI client to select a .R file to source()
-	return(guiCmd("source", ...))  # TODO: should use sys.source() here
+	guiCmd("source", ...)  # TODO: should use sys.source() here
 }
 
 guiSave <- function (...)
 {
 	## Ask the GUI client for a file where to save some data
-	return(guiCmd("save", ...))
+	guiCmd("save", ...)
 }
 
 guiImport <- function (...)
 {
 	## Ask the client to display a dialog for importing some data
-	return(guiCmd("import", ...))
+	guiCmd("import", ...)
 }
 
 guiExport <- function (...)
 {
 	## Ask the client to display a dialog for exporting some data
-	return(guiCmd("export", ...))
+	guiCmd("export", ...)
 }
 
 guiReport <- function (...)
 {
 	## Ask the client to display a dialog for reporting data (send a view...)
-	return(guiCmd("report", ...))
+	guiCmd("report", ...)
 }
 
 guiSetwd <- function (...)
 {
 	## Ask the GUI client to select a directory to set as active
-	return(guiCmd("setwd", ...))
+	guiCmd("setwd", ...)
 }

Modified: pkg/svMisc/R/helpSearchWeb.R
===================================================================
--- pkg/svMisc/R/helpSearchWeb.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/helpSearchWeb.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -20,5 +20,5 @@
 			cat(gettext("The results page should open in your browser shortly\n"))
 		}
 	}
-	return(invisible(searchURL))
+	invisible(searchURL)
 }

Modified: pkg/svMisc/R/isHelp.R
===================================================================
--- pkg/svMisc/R/isHelp.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/isHelp.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -16,6 +16,6 @@
     encoding <- "UTF-8"
     tools::Rd2ex(utils:::.getHelpFile(file), tf)
     if (!file.exists(tf)) {
-        return(c(help = TRUE, example = FALSE))
-    } else return(c(help = TRUE, example = TRUE))
+        c(help = TRUE, example = FALSE)
+    } else c(help = TRUE, example = TRUE)
 }

Modified: pkg/svMisc/R/isSDI.R
===================================================================
--- pkg/svMisc/R/isSDI.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/isSDI.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -7,5 +7,5 @@
 	# First, is it Rgui?
 	if (!isRgui()) return(FALSE)
     # RGui SDI mode: returns "R Console", in MDI mode: returns "RGui"
-    if (getIdentification() == "R Console") return(TRUE) else return(FALSE)
+    if (getIdentification() == "R Console") TRUE else FALSE
 }

Modified: pkg/svMisc/R/listTypes.R
===================================================================
--- pkg/svMisc/R/listTypes.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/listTypes.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -23,5 +23,5 @@
 		## Sort the final list and eliminate duplicated items
 		List <- sort(unique(List))
 	}
-	return(List)
+	List
 }

Modified: pkg/svMisc/R/objBrowse.R
===================================================================
--- pkg/svMisc/R/objBrowse.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/objBrowse.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -123,5 +123,5 @@
 	CmdFun <- getTemp(".guiObjBrowse", mode = "function")
     if (!is.null(CmdFun)) CmdFun(id = id, data = Data)
 	## Return the data invisibly
-	return(invisible(Data))
+	invisible(Data)
 }

Modified: pkg/svMisc/R/objClear.R
===================================================================
--- pkg/svMisc/R/objClear.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/objClear.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -17,5 +17,5 @@
 	if (file.exists(ListFile)) unlink(ListFile)
 	MenuFile = file.path(Root, paste("Menu_", id, ".txt", sep=""))
 	if (file.exists(MenuFile)) unlink(MenuFile)
-	return(invisible(TRUE))
+	invisible(TRUE)
 }

Modified: pkg/svMisc/R/objList.R
===================================================================
--- pkg/svMisc/R/objList.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/objList.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -163,7 +163,7 @@
 		attr(x, "envir"), attr(x, "all.names"), attr(x, "pattern"),
 		attr(x, "group")), file = ParsF, append = FALSE)
 
-	return(invisible(ListF))
+	invisible(ListF)
 }
 
 print.objList <- function (x, sep = NA, eol = "\n",
@@ -196,7 +196,7 @@
 				eol = eol, quote = FALSE)
 		}
 	}
-	return(invisible(x))
+	invisible(x)
 }
 
 ## Called by objList() when object is provided
@@ -237,7 +237,7 @@
 	if (!is.null(ret))
 		names(ret) <- c("Name", "Full.name", "Dims/default", "Group", "Class",
 			"Recursive")
-	return(ret)
+	ret
 }
 
 # Called by .lsObj for functions
@@ -271,7 +271,7 @@
 	}))
 
 	ret <- data.frame(itemnames, fullnames, ret, stringsAsFactors = FALSE)
-	return(ret)
+	ret
 }
 
 ## Called by .lsObj in S4 case
@@ -285,7 +285,7 @@
 	ret <- t(sapply(itemnames, function (i) .objDescr(slot(obj, i))))
 
 	ret <- data.frame(itemnames, fullnames, ret, stringsAsFactors = FALSE)
-	return(ret)
+	ret
 }
 
 ## Returns a *character* vector with elements: dims, mode, class, rec(ursive)
@@ -293,8 +293,8 @@
 	d <- dim(x)
 	if (is.null(d)) d <- length(x)
 
-	return(c(dims = paste(d, collapse = "x"),
+	c(dims = paste(d, collapse = "x"),
 		mode = mode(x), class = class(x)[1],
 		rec = mode(x) == "S4" || is.function(x) ||
-		(is.recursive(x) && !is.language(x) && sum(d) != 0)))
+		(is.recursive(x) && !is.language(x) && sum(d) != 0))
 }

Modified: pkg/svMisc/R/parseText.R
===================================================================
--- pkg/svMisc/R/parseText.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/parseText.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -5,8 +5,9 @@
 	return(parseText(text))
 }
 
-`parseText` <- function (text, firstline = 1, srcfilename = NULL,
-encoding = "unknown") {
+parseText <- function (text, firstline = 1, srcfilename = NULL,
+encoding = "unknown")
+{
 	## Parse R instructions provided as a string and return the expression if it
 	## is correct, or a 'try-error' object if it is an incorrect code, or NA if
 	## the (last) instruction is incomplete
@@ -23,14 +24,12 @@
 		## Check if this is incomplete code
 		msg <- conditionMessage(res)
 		
+		## Incomplete string
+		if (regexpr(gettext("INCOMPLETE_STRING", domain = "R"), msg) > 0)
+			return(NA)
+		## Incomplete instruction
 		if (regexpr(gettext("end of input", domain = "R"), msg) > 0)
 			return(NA)	
-		## TODO: this is from SciViews-K-dev,... but does not seem to work?!
-		#rxUEOI <- sprintf(gsub("%d", "\\\\d+", gettext("%s%d:%d: %s",
-		#	domain = "R")), if (getOption("keep.source")) "<text>:" else "",
-		#	gettextf("unexpected %s", gettext("end of input", domain = "R"),
-		#	domain = "R"))
-		#if (regexpr(rxUEOI, msg, perl = TRUE) == 1) return(NA)
 		
 		## This should be incorrect R code
 		## Rework the message a little bit... keep line:col position in front
@@ -63,5 +62,5 @@
 		attr(res, 'error') <- err
 	}
 
-    return(res)
+    res
 }

Modified: pkg/svMisc/R/pkg.R
===================================================================
--- pkg/svMisc/R/pkg.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/pkg.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -4,6 +4,7 @@
 	return(pkg(...))
 }
 
+## TODO: name this package() instead???
 pkg <- function (..., warn = TRUE)
 {
 	## A multiple require proceeding as silently as possible
@@ -28,5 +29,5 @@
 				paste(bads, collapse = ", "), "!\n")
 		}
 	}
-	return(invisible(check))
+	invisible(check)
 }

Modified: pkg/svMisc/R/rjson.R
===================================================================
--- pkg/svMisc/R/rjson.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/rjson.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -121,7 +121,7 @@
 	#res <- sub("^list\\(", "hash(", res)
 	
 	## Return  the no quoted results
-	return(noquote(res))
+	noquote(res)
 }
 
 evalRjson <- function (rjson) {
@@ -142,7 +142,7 @@
 	## argument (being the RJSOn object converted to R)
 	
 	## We need first to convert all ':=' into '='
-	return(eval(parse(text = gsub(":=", "=", rjson, fixed = TRUE))))
+	eval(parse(text = gsub(":=", "=", rjson, fixed = TRUE)))
 }
 
 # Simple JSON for lists containing character strings
@@ -159,5 +159,5 @@
 				quote = '"'), ":", x, sep = ""), collapse = ","), "}", sep = "")
 		}
 	}
-	return(x)
+	x
 }

Modified: pkg/svMisc/R/rmTemp.R
===================================================================
--- pkg/svMisc/R/rmTemp.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/rmTemp.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -11,5 +11,5 @@
 			envir = TempEnv()), silent = TRUE)
 		if (!exst || inherits(res0, "try-error")) res[i] <- FALSE
 	}
-	return(invisible(res))
+	invisible(res)
 }

Modified: pkg/svMisc/R/sourceClipboard.R
===================================================================
--- pkg/svMisc/R/sourceClipboard.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/sourceClipboard.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -2,7 +2,7 @@
 {
 	## Deprecated, in favor of sourceClipboard
 	.Deprecated("sourceClipboard")
-	return(sourceClipboard(primary = primary, ...))
+	sourceClipboard(primary = primary, ...)
 }
 
 sourceClipboard <- function (primary = TRUE, ...)
@@ -22,6 +22,5 @@
 	}
 	on.exit(close(data))
 	## Invoke source() with the data from the clipboard
-	res <- source(data, ...)
-	return(invisible(res))
+	invisible(source(data, ...))
 }

Modified: pkg/svMisc/R/systemFile.R
===================================================================
--- pkg/svMisc/R/systemFile.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/systemFile.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -1,13 +1,13 @@
 Sys.tempdir <- function ()
 {
 	.Deprecated("systemDir")
-	return(systemDir("sysTemp"))
+	systemDir("sysTemp")
 }
 
 Sys.userdir <- function ()
 {
 	.Deprecated("systemDir")
-	return(systemDir("user"))
+	systemDir("user")
 }
 
 systemFile <- function (..., exec = FALSE, package = NULL, lib.loc = NULL)
@@ -27,7 +27,7 @@
 		file <- file.path(file)
 		if (file_test("-f", file)) res <- normalizePath(file) else res <- ""
 	}
-	return(res)
+	res
 }
 
 systemDir <- function (..., exec = FALSE, package = NULL, lib.loc = NULL)
@@ -71,5 +71,5 @@
 				res[i] <- getDir(which[i])
 		}
 	}
-	return(res)
+	res
 }

Modified: pkg/svMisc/R/tempvar.R
===================================================================
--- pkg/svMisc/R/tempvar.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svMisc/R/tempvar.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -5,5 +5,5 @@
 		var <- paste(pattern, as.integer(runif(1) * 100000), sep = "")
 		if (!exists(var, where = 1, inherits = TRUE)) break()
 	}
-	return(var)
+	var
 }

Modified: pkg/svSweave/R/tangleLyxRnw.R
===================================================================
--- pkg/svSweave/R/tangleLyxRnw.R	2013-01-12 11:28:08 UTC (rev 513)
+++ pkg/svSweave/R/tangleLyxRnw.R	2013-01-24 20:04:06 UTC (rev 514)
@@ -10,20 +10,20 @@
 	
 	## Switch encoding (we do work with UTF-8 by default)
 	oenc <- options(encoding = encoding)
-	on.exit(options(encooding = oenc))
+	on.exit(options(oenc))
 	Sys.setlocale("LC_CTYPE", "UTF-8")
 
 	## By default, use fancy quotes
 	ofc <- options(useFancyQuotes = useFancyQuotes)
-	on.exit(options(useFancyQuotes = ofc), add = TRUE)
+	on.exit(options(ofc), add = TRUE)
 	
 	## Set default width for text to a reasonable value
 	owidth <- options(width = width)
-	on.exit(options(width = owidth), add = TRUE)
+	on.exit(options(owidth), add = TRUE)
 
 	## Issue warnings immediately
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/sciviews -r 514


More information about the Sciviews-commits mailing list