From: Christophe Rhodes Date: Fri, 1 Oct 2010 18:58:33 +0000 (+0100) Subject: implement swank:load-file and swank:compile-file-for-emacs X-Git-Url: http://christophe.rhodes.io/gitweb/?p=swankr.git;a=commitdiff_plain;h=3cd1b16491b64549d5e00e32e75ce069cd8d201f implement swank:load-file and swank:compile-file-for-emacs 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. --- diff --git a/TODO.org b/TODO.org index 4dc1cde..180cd94 100644 --- 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 @@ -39,11 +39,11 @@ - [ ] 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 5fe20bb..22cec64 100644 --- 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 +}