Christophe Weblog Wiki Code Publications Music
implement swank:load-file and swank:compile-file-for-emacs
[swankr.git] / swank.R
diff --git a/swank.R b/swank.R
index 4af51d133e1641891c38bf57a701e86523295d73..22cec64d58f898fad9ce4c68b22110bdd4b4c103 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -613,3 +613,26 @@ emacsInspect.numeric <- function(numeric) {
   object <- get(name, envir=frame)
   inspectObject(slimeConnection, object)
 }
+
+`swank:default-directory` <- function(slimeConnection, sldbState) {
+  getwd()
+}
+
+`swank:set-default-directory` <- function(slimeConnection, sldbState, directory) {
+  setwd(directory)
+  `swank:default-directory`(slimeConnection, sldbState)
+}
+
+`swank:load-file` <- function(slimeConnection, sldbState, filename) {
+  source(filename, local=FALSE)
+  TRUE
+}
+
+`swank:compile-file-for-emacs` <- function(slimeConnection, sldbState, filename, loadp, ...) {
+  if(loadp==quote(`t`)) {
+    source(filename, local=FALSE)
+  } else {
+    parse(filename)
+  }
+  TRUE
+}