[Gd-chatter] r11745 - trunk/fundev/sources/environment/dswank
hannes at gwydiondylan.org
hannes at gwydiondylan.org
Mon Mar 24 04:39:35 CET 2008
Author: hannes
Date: Mon Mar 24 04:39:34 2008
New Revision: 11745
Modified:
trunk/fundev/sources/environment/dswank/dswank-exports.dylan
trunk/fundev/sources/environment/dswank/dswank.dylan
Log:
Job: fd
support for more commands:
*quit-lisp - that was easy
*default-directory/set-default-directory: sets working directory
*list-all-package-names: for completion... here we list all library
names
*set-package: sets package to given string (and opens this package)
The problem we now face is that LISP only has packages, where Dylan has
libraries and modules... thus, a package has probably to be a library and
a module (library:module as in the Dylan IDE). This information is sadly
not available; we have two different cases:
a .dylan file is opened -> there we have the "module:" header, and we
want to find definitions/descriptions of various forms
set-package or in-package is called and something in the lisp shell
needs to be described. here we have a library name from the completion
of the defined registries, but we have no modules.
If we open all compiler databases and ask the compiler for all modules of
a given library/project, this takes really long. And a startup of > 2s of
dswank is not usable anymore.
In the former case we currently have the assumption that the project in
development is open. This can either be done by ", set-package" or via
"open" in the slime shell.
The natural way would be to have separate commands for setting library
and module (slime would have to be changed...). Or some magic voodoo
in dylan-mode which provides the knowledge what library the file belongs
to.
Modified: trunk/fundev/sources/environment/dswank/dswank-exports.dylan
==============================================================================
--- trunk/fundev/sources/environment/dswank/dswank-exports.dylan (original)
+++ trunk/fundev/sources/environment/dswank/dswank-exports.dylan Mon Mar 24 04:39:34 2008
@@ -11,6 +11,7 @@
use source-records;
use file-source-records;
use system;
+ use registry-projects;
end library;
define module dswank
@@ -28,4 +29,5 @@
use file-source-records;
use file-system;
use locators;
+ use registry-projects;
end module;
Modified: trunk/fundev/sources/environment/dswank/dswank.dylan
==============================================================================
--- trunk/fundev/sources/environment/dswank/dswank.dylan (original)
+++ trunk/fundev/sources/environment/dswank/dswank.dylan Mon Mar 24 04:39:34 2008
@@ -58,20 +58,72 @@
#":version", "2008-03-18");
end;
+define swank-function quit-lisp ()
+ exit-application(0);
+end;
+
+define swank-function list-all-package-names (t)
+ let res = #();
+ local method collect-project
+ (dir :: <pathname>, filename :: <string>, type :: <file-type>)
+ if (type == #"file" & filename ~= "Open-Source-License.txt")
+ if (last(filename) ~= '~')
+ res := pair(filename, res);
+ end;
+ end;
+ end;
+ let regs = find-registries("x86", "linux");
+ let reg-paths = map(registry-location, regs);
+ for (reg-path in reg-paths)
+ if (file-exists?(reg-path))
+ do-directory(collect-project, reg-path);
+ end;
+ end;
+ res;
+end;
+
+define thread variable *project* = #f;
+
+define swank-function set-package (package-name)
+ run-compiler(*server*, concatenate("open ", package-name));
+ *project* := package-name;
+ list(package-name, package-name);
+end;
+
+define swank-function default-directory ()
+ as(<string>, working-directory());
+end;
+
+define swank-function set-default-directory (new-directory)
+ working-directory-setter(expand-pathname(new-directory));
+ new-directory;
+end;
+
+//define swank-function describe-symbol (symbol-name)
+//end;
+
define swank-function find-definitions-for-emacs (symbol-name)
- let project = open-projects()[0];
let library = #f;
let module = #f;
- local method check-and-set-module (lib)
+ let project = #f;
+ local method check-and-set-module (p, lib)
unless(module)
- module := find-module(project, *package*, library: lib);
+ module := find-module(p, *package*, library: lib);
if (module)
library := lib;
end;
end;
end;
- check-and-set-module(project-library(project));
- do-project-used-libraries (check-and-set-module, project, project);
+
+ for (p in open-projects())
+ unless (project)
+ check-and-set-module(p, project-library(p));
+ do-project-used-libraries(curry(check-and-set-module, p), p, p);
+ if (library)
+ project := p;
+ end;
+ end;
+ end;
let env-obj = find-environment-object(project, symbol-name,
library: library,
More information about the chatter
mailing list