[slime-cvs] CVS slime/contrib
CVS User trittweiler
trittweiler at common-lisp.net
Sat Nov 21 16:27:56 UTC 2009
Update of /project/slime/cvsroot/slime/contrib
In directory cl-net:/tmp/cvs-serv26148/contrib
Modified Files:
swank-asdf.lisp slime-asdf.el ChangeLog
Log Message:
* swank-asdf.lisp (asdf-determine-system): Also try to determine
the current system by looking at the buffer-package.
* slime-asdf (slime-read-system-name): Adapted accordingly.
--- /project/slime/cvsroot/slime/contrib/swank-asdf.lisp 2009/11/17 10:13:40 1.12
+++ /project/slime/cvsroot/slime/contrib/swank-asdf.lisp 2009/11/21 16:27:55 1.13
@@ -107,11 +107,23 @@
(asdf:module
(system-contains-file-p component pathname pathname-name)))))
-(defslimefun asdf-determine-system (file)
- (loop with pathname = (pathname file)
- with pathname-name = (pathname-name pathname)
- for (nil . system) being the hash-value of asdf::*defined-systems*
- when (system-contains-file-p system pathname pathname-name)
- return (asdf:component-name system)))
+(defslimefun asdf-determine-system (file buffer-package-name)
+ ;; First try to grovel through all defined systems to find a system
+ ;; which contains FILE.
+ (when file
+ (loop with pathname = (pathname file)
+ with pathname-name = (pathname-name pathname)
+ for (nil . system) being the hash-value of asdf::*defined-systems*
+ when (system-contains-file-p system pathname pathname-name)
+ do (return-from asdf-determine-system
+ (asdf:component-name system))))
+ ;; If we couldn't find a system by that, we now try if there's a
+ ;; system that's named like BUFFER-PACKAGE-NAME.
+ (let ((package (guess-buffer-package buffer-package-name)))
+ (dolist (name (package-names package))
+ (let ((system (asdf:find-system (string-downcase name) nil)))
+ (when system
+ (return-from asdf-determine-system
+ (asdf:component-name system)))))))
(provide :swank-asdf)
--- /project/slime/cvsroot/slime/contrib/slime-asdf.el 2009/11/19 13:37:45 1.15
+++ /project/slime/cvsroot/slime/contrib/slime-asdf.el 2009/11/21 16:27:55 1.16
@@ -38,7 +38,8 @@
(system-names (slime-eval `(swank:list-asdf-systems)))
(default-value (or default-value
(if determine-default-accurately
- (slime-determine-asdf-system (buffer-file-name))
+ (slime-determine-asdf-system (buffer-file-name)
+ (slime-current-package))
(slime-find-asd-file (or default-directory
(buffer-file-name))
system-names))))
@@ -61,9 +62,9 @@
when (find candidate system-names :test #'string-equal)
do (return candidate))))
-(defun slime-determine-asdf-system (filename)
+(defun slime-determine-asdf-system (filename buffer-package)
"Try to determine the asdf system that `filename' belongs to."
- (slime-eval `(swank:asdf-determine-system ,filename)))
+ (slime-eval `(swank:asdf-determine-system ,filename ,buffer-package)))
(defun slime-oos (system operation &rest keyword-args)
"Operate On System."
--- /project/slime/cvsroot/slime/contrib/ChangeLog 2009/11/20 15:48:18 1.279
+++ /project/slime/cvsroot/slime/contrib/ChangeLog 2009/11/21 16:27:55 1.280
@@ -1,3 +1,10 @@
+2009-11-21 Tobias C. Rittweiler <tcr at freebits.de>
+
+ * swank-asdf.lisp (asdf-determine-system): Also try to determine
+ the current system by looking at the buffer-package.
+
+ * slime-asdf (slime-read-system-name): Adapted accordingly.
+
2009-11-20 Stas Boukarev <stassats at gmail.com>
* slime-repl.el (slime-repl-position-in-history): Add new optional
More information about the slime-cvs
mailing list