+ if(!exists(op, envir = globalenv())) {
+ return(list())
+ }
+ funoid <- get(op, envir = globalenv())
+ if(is.function(funoid)) {
+ args <- formals(funoid)
+ paste(sprintf("%s=%s", names(args), args), collapse=", ")
+ } else {
+ list()
+ }
+}
+
+`swank:describe-function` <- function(slimeConnection, sldbState, op, package) {
+ ## FIXME: maybe not the best match?
+ `swank:operator-arglist`(slimeConnection, sldbState, op, package)
+}
+
+helpFilesWithTopicString <- function(value) {
+ output <- capture.output(tools:::Rd2txt(utils:::.getHelpFile(value),
+ options=list(underline_titles=FALSE)))
+ paste(output, collapse="\n")
+}
+
+`swank:describe-symbol` <- function(slimeConnection, sldbState, op, package) {
+ value <- help(op)
+ helpFilesWithTopicString(value)
+}
+
+`swank:apropos-list-for-emacs` <- function(slimeConnection, sldbState, name, onlyExternal, package, caseSensitive) {
+ x <- help.search(name, fields="alias", package=.packages())$matches
+ brieflyDescribe <- function(name, title) {
+ if (exists(name, globalenv())) {
+ val <- get(name, globalenv())
+ kind <- if("function" %in% class(val)) quote(`:function`) else quote(`:variable`)
+ list(quote(`:designator`), name, kind, title)
+ } else {
+ ## maybe
+ list(quote(`:designator`), name, quote(`:type`), title)
+ }
+ }
+ mapply(brieflyDescribe, x[,"name"], x[,"title"], SIMPLIFY=FALSE)
+}
+
+`swank:describe-definition-for-emacs` <- function(slimeConnection, sldbState, name, kind) {
+ `swank:describe-symbol`(slimeConnection, sldbState, name, NULL)