]> rhodes.io Git - swankr.git/commitdiff
Christophe Weblog Wiki Code Publications Music
fix swank:compile-file-for-emacs when loadp is true
authorChristophe Rhodes <csr21@cantab.net>
Wed, 6 Apr 2011 07:59:05 +0000 (08:59 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Wed, 6 Apr 2011 07:59:05 +0000 (08:59 +0100)
also retain source information in swank:load-file for maximum emacs
goodness.

swank.R

diff --git a/swank.R b/swank.R
index 7dd9d5c0a07676a70d433919acd376495b619ccc..34998b652e189799bc6bf70461099f50bc5d68eb 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -690,12 +690,18 @@ emacsInspect.numeric <- function(numeric) {
 }
 
 `swank:load-file` <- function(slimeConnection, sldbState, filename) {
-  source(filename, local=FALSE)
+  source(filename, local=FALSE, keep.source=TRUE)
   TRUE
 }
 
 `swank:compile-file-for-emacs` <- function(slimeConnection, sldbState, filename, loadp, ...) {
-  times <- system.time(parse(filename))
+  times <- system.time(parse(filename, srcfile=srcfile(filename)))
+  if(loadp) {
+    ## KLUDGE: inelegant, but works.  It might be more in the spirit
+    ## of things to keep the result of the parse above around to
+    ## evaluate.
+    `swank:load-file`(slimeConnection, sldbState, filename)
+  }
   list(quote(`:compilation-result`), list(), TRUE, times[3], substitute(loadp), filename)
 }