]> rhodes.io Git - swankr.git/commitdiff
Christophe Weblog Wiki Code Publications Music
implement swank:load-file and swank:compile-file-for-emacs
authorChristophe Rhodes <csr21@cantab.net>
Fri, 1 Oct 2010 18:58:33 +0000 (19:58 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Fri, 1 Oct 2010 18:58:33 +0000 (19:58 +0100)
Easy, peasy.  The only trick here is to use parse() in the case that
compile-file-for-emacs is not being asked to load the `compiled' file.

TODO.org
swank.R

index 4dc1cde840d51a60ced9cd069e91ae962230bae5..180cd9445a22aff652c9ff970f482c045d94ccd4 100644 (file)
--- a/TODO.org
+++ b/TODO.org
@@ -3,7 +3,7 @@
 #+EMAIL: csr21@cantab.net
 #+OPTIONS: H:2
 * Protocol requests
-** core slimefuns [31/95]
+** core slimefuns [33/95]
    - [ ] ping
    - [X] create-repl
    - [ ] create-listener
    - [ ] sldb-step
    - [ ] sldb-next
    - [ ] sldb-out
-   - [ ] compile-file-for-emacs
+   - [X] compile-file-for-emacs
    - [X] compile-string-for-emacs
    - [ ] compile-multiple-strings-for-emacs
    - [ ] compile-file-if-needed
-   - [ ] load-file
+   - [X] load-file
    - [X] swank-require
    - [ ] swank-macroexpand-1
    - [ ] swank-macroexpand
diff --git a/swank.R b/swank.R
index 5fe20bbefe633d6a9f1c1e0009f11e0cef32c9d6..22cec64d58f898fad9ce4c68b22110bdd4b4c103 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -622,3 +622,17 @@ emacsInspect.numeric <- function(numeric) {
   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
+}