emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ess 39ffc022c1 3/4: rc.options(dots=FALSE) + cosmetics


From: ELPA Syncer
Subject: [elpa] externals/ess 39ffc022c1 3/4: rc.options(dots=FALSE) + cosmetics
Date: Mon, 21 Nov 2022 11:57:55 -0500 (EST)

branch: externals/ess
commit 39ffc022c1bf8f095ceceac7e35baea58c7d6cf8
Author: Martin Maechler <maechler@r-project.org>
Commit: Martin Maechler <maechler@r-project.org>

    rc.options(dots=FALSE) + cosmetics
---
 etc/ESSR/R/completion.R | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/etc/ESSR/R/completion.R b/etc/ESSR/R/completion.R
index 2288436ac1..50017df081 100644
--- a/etc/ESSR/R/completion.R
+++ b/etc/ESSR/R/completion.R
@@ -9,7 +9,7 @@ if(!exists("local"))
     local <- function(expr, envir = environment()) { invisible(eval(expr, 
envir=envir)) }
 
 ##' Robust version of
-##'    utils:::.addFunctionInfo(c = c("recursive", "use.names"))
+##'    utils:::.addFunctionInfo(c = c("recursive", "use.names")) #  needed 
only for R <= 3.y.z
 local({
     U <- asNamespace("utils"); fn <- ".addFunctionInfo"
     EX <- exists(fn, envir=U)
@@ -30,6 +30,7 @@ local({
     else x
 }
 
+## not needed for completion;   called from  (ess-r-xref--srcref *) in  
../../../lisp/ess-r-xref.el
 .ess_srcref <- function(name, pkg) {
     if (!is.null(pkg) && requireNamespace(pkg)) {
         env <- asNamespace(pkg)
@@ -39,19 +40,17 @@ local({
     fn <- .ess_eval(name, env)
     if (is.null(fn)) {
         objs <- utils::getAnywhere(name)$objs
-        for (o in objs) {
-            if (is.function(o)) {
-                fn <- o
-                break;
-            }
+        for (fn in objs) {
+            if(is.function(fn))
+                break
         }
     }
     out <- "()\n"
     if (is.function(fn) && !is.null(utils::getSrcref(fn))) {
         file <- utils::getSrcFilename(fn, full.names = TRUE)
         if (file != "") {
-            line <- .ess_nonull(utils::getSrcLocation(fn, "line"), 1)
-            col <- .ess_nonull(utils::getSrcLocation(fn, "column"), 1)
+            line <- .ess_nonull(utils::getSrcLocation(fn, "line"  ), 1)
+            col  <- .ess_nonull(utils::getSrcLocation(fn, "column"), 1)
             out <- sprintf("(\"%s\" %d %d)\n", file, line, col - 1)
         }
     }
@@ -112,7 +111,11 @@ local({
 .ess_get_completions <- function(string, end, suffix = " = ") {
     oldopts <- utils::rc.options(funarg.suffix = suffix)
     on.exit(utils::rc.options(oldopts))
-    if(.ess.Rversion > '2.14.1'){
+    sett <- utils::rc.settings
+    oldDots <- sett()[["dots"]]
+    on.exit(sett(dots=oldDots), add=TRUE)
+    sett(dots = FALSE)
+    if(.ess.Rversion > '2.14.1') {
         comp <- compiler::enableJIT(0)
         op <- options(error=NULL)
         on.exit({ options(op); compiler::enableJIT(comp)}, add = TRUE)
@@ -125,7 +128,7 @@ local({
       utils:::.retrieveCompletions())
 }
 
-.ess_arg_help <- function(arg, func){
+.ess_arg_help <- function(arg, func) {
     op <- options(error=NULL)
     on.exit(options(op))
     fguess <-
@@ -151,9 +154,9 @@ local({
         }
     }
     funcs <- c(fguess, tryCatch(methods(fguess),
-                                warning=function(w) {NULL},
-                                error=function(e) {NULL}))
-    if(length(funcs) > 1 && length(pos <- grep('default', funcs))){
+                                warning= function(w) NULL,
+                                error  = function(e) NULL))
+    if(length(funcs) > 1 && length(pos <- grep('default', funcs))) {
         funcs <- c(funcs[[pos[[1]]]], funcs[-pos[[1]]])
     }
     i <- 1; found <- FALSE



reply via email to

[Prev in Thread] Current Thread [Next in Thread]