Christophe Weblog Wiki Code Publications Music
`swank:describe-function` and `swank:describe-symbol` implementations
authorChristophe Rhodes <csr21@cantab.net>
Sat, 11 Jan 2014 14:40:45 +0000 (14:40 +0000)
committerChristophe Rhodes <csr21@cantab.net>
Sat, 11 Jan 2014 14:40:45 +0000 (14:40 +0000)
from Philipp Marek, about an eternity ago.

swank-media.R
swank.R

index 59f7d772e9c2e9e67f664b522c180981fa84ef78..12405265e31de9d8285fa128e98d9a68c21838f1 100644 (file)
@@ -42,9 +42,7 @@ makeMediaReplResult.matrix <- function(value) {
 }
 
 makeMediaReplResult.help_files_with_topic <- function(value) {
 }
 
 makeMediaReplResult.help_files_with_topic <- function(value) {
-  output <- capture.output(tools:::Rd2txt(utils:::.getHelpFile(value),
-                                          options=list(underline_titles=FALSE)))
-  string <- paste(output, collapse="\n")
+  string <- helpFilesWithTopicString(value)
   list(quote(`:popup-buffer`), sprintf("*slime-help(%s)*", attr(value, "topic")),
        string, quote(`ess-help-mode`))
 }
   list(quote(`:popup-buffer`), sprintf("*slime-help(%s)*", attr(value, "topic")),
        string, quote(`ess-help-mode`))
 }
diff --git a/swank.R b/swank.R
index 8ba9060f6147a47956ba4e6e18a8d4a8ebd9be45..67fdbbcfc9cdb1d63e72130a3e169176312f9584 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -361,6 +361,22 @@ sendReplResultFunction <- sendReplResult
   }
 }
 
   }
 }
 
+`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:throw-to-toplevel` <- function(slimeConnection, sldbState) {
   condition <- simpleCondition("Throw to toplevel")
   class(condition) <- c("swankTopLevel", class(condition))
 `swank:throw-to-toplevel` <- function(slimeConnection, sldbState) {
   condition <- simpleCondition("Throw to toplevel")
   class(condition) <- c("swankTopLevel", class(condition))