[slime-cvs] CVS update: slime/swank.lisp

Luke Gorrie lgorrie at common-lisp.net
Mon Dec 15 12:01:20 UTC 2003


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv16410

Modified Files:
	swank.lisp 
Log Message:
(eval-region, shortest-package-nickname): Report the shortest package
nickname to Emacs (for the REPL prompt). Patch from Marco Baringer.

Date: Mon Dec 15 07:01:20 2003
Author: lgorrie

Index: slime/swank.lisp
diff -u slime/swank.lisp:1.80 slime/swank.lisp:1.81
--- slime/swank.lisp:1.80	Mon Dec 15 00:29:10 2003
+++ slime/swank.lisp	Mon Dec 15 07:01:20 2003
@@ -423,7 +423,15 @@
                  do (force-output)
                  finally (return (values values -))))
       (when (and package-update-p (not (eq *package* *buffer-package*)))
-        (send-to-emacs (list :new-package (package-name *package*)))))))
+        (send-to-emacs (list :new-package (shortest-package-nickname *package*)))))))
+
+(defun shortest-package-nickname (package)
+  "Return the shortest nickname (or canonical name) of PACKAGE."
+  (loop for name in (cons (package-name package) (package-nicknames package))
+        for shortest = name then (if (< (length name) (length shortest))
+                                     name
+                                     shortest)
+        finally (return shortest)))
 
 (defslimefun interactive-eval-region (string)
   (let ((*package* *buffer-package*))





More information about the slime-cvs mailing list