Christophe Weblog Wiki Code Publications Music
implement swank:default-directory and swank:set-default-directory
authorChristophe Rhodes <csr21@cantab.net>
Fri, 1 Oct 2010 18:56:26 +0000 (19:56 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Fri, 1 Oct 2010 18:56:26 +0000 (19:56 +0100)
It was surprisingly hard to intuit getwd() and setwd(), what with
apropos("dir") and apropos("cwd") failing.  Nevertheless, they exist
and function, so use them for the interface (but not slimefun)
functions.

TODO.org
swank.R

index 3dd5db2fc94dfac5a03994bb5f5a75e708d6fc5f..4dc1cde840d51a60ced9cd069e91ae962230bae5 100644 (file)
--- a/TODO.org
+++ b/TODO.org
@@ -3,7 +3,7 @@
 #+EMAIL: csr21@cantab.net
 #+OPTIONS: H:2
 * Protocol requests
-** core slimefuns [29/93]
+** core slimefuns [31/95]
    - [ ] ping
    - [X] create-repl
    - [ ] create-listener
@@ -97,6 +97,8 @@
    - [ ] update-indentation-information
    - [X] frame-source-location (NB: not currently a slimefun)
    - [X] buffer-first-change (NB: not currently a slimefun)
+   - [X] default-directory (NB: not currently a slimefun)
+   - [X] set-default-directory (NB: not currently a slimefun)
 ** swank-presentations [4/5]
    - [X] lookup-presented-object
    - [X] lookup-presented-object-or-lose
diff --git a/swank.R b/swank.R
index 4af51d133e1641891c38bf57a701e86523295d73..5fe20bbefe633d6a9f1c1e0009f11e0cef32c9d6 100644 (file)
--- a/swank.R
+++ b/swank.R
@@ -613,3 +613,12 @@ 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)
+}