[slime-devel] Feature: slime-repl-set-package
Michael Weber
michaelw+slime at foldr.org
Thu Jan 22 08:00:52 UTC 2004
* Michael Weber <michaelw+slime at foldr.org> [2004-01-22T01:28+0100]:
> As an aside: it would be extremely helpful if SLIME and SWANK
> functions would be properly documented.
Whoops, now why did I sent the wrong patch (without docs)... :/
Same patch this time with docs strings attached.
Cheers,
Michael
-------------- next part --------------
cvs server: Diffing .
Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.195
diff -u -r1.195 slime.el
--- slime.el 21 Jan 2004 22:00:33 -0000 1.195
+++ slime.el 21 Jan 2004 23:38:19 -0000
@@ -3971,6 +3986,18 @@
(t
(error "Busy - can't attach in current state (%S)"
(slime-current-state)))))
+
+(defun slime-repl-set-package (package)
+ "Sets the package of the REPL buffer to PACKAGE."
+ (interactive (list (slime-read-package-name "Package: "
+ (slime-find-buffer-package))))
+ (with-current-buffer (slime-output-buffer)
+ (let ((unfinished-input (slime-repl-current-input)))
+ (slime-mark-output-start)
+ (slime-with-output-end-mark
+ (slime-eval `(swank:set-repl-package ,package))
+ (slime-repl-insert-prompt "")
+ (insert unfinished-input)))))
(defun slime-set-package (package)
(interactive (list (slime-read-package-name "Package: "
Index: swank.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank.lisp,v
retrieving revision 1.107
diff -u -r1.107 swank.lisp
--- swank.lisp 21 Jan 2004 23:26:32 -0000 1.107
+++ swank.lisp 21 Jan 2004 23:38:19 -0000
@@ -762,6 +762,12 @@
(setq *package* (guess-package-from-string package))
(package-name *package*))
+(defslimefun set-repl-package (package)
+ "Sets package of the REPL to PACKAGE and reports back to emacs."
+ (setq *package* (guess-package-from-string package))
+ (send-to-emacs
+ `(:new-package ,(shortest-package-nickname *package*))))
+
(defslimefun listener-eval (string)
(clear-user-input)
(multiple-value-bind (values last-form) (eval-region string t)
More information about the slime-devel
mailing list