[slime-devel] Re: Canonical package nicknames patch

lawrence mitchell wence at gmx.li
Fri Jul 9 17:50:54 UTC 2004


Peter Seibel wrote:

[...]

> Also, I was hacking around some more with another addition to
> shortest-package-nickname to automatically create abbreviations for
> dotted package names:

>   CL-USER> (in-package :com.gigamonkeys.spam)
>   #<The COM.GIGAMONKEYS.SPAM package>
>   SPAM>

How about abbreviating to

  C.G.SPAM>

That way, you are possibly less likely to be confused if you have
two packages ending with the same name.

Something like:

(defun auto-abbreviated-package-name (package)
  (when *auto-abbreviate-dotted-packages*
    (let ((name (make-array '(0) :element-type 'base-char
                            :fill-pointer 0 :adjustable t))
          (pname (package-name package))
          (dot nil))
      (with-output-to-string (s name)
        (while (setf dot (position #\. pname))
          (princ (char pname 0) s)
          (princ #\. s)
          (setf pname (subseq pname (1+ dot))))
        (princ pname s))
      name)))

perhaps.

-- 
lawrence mitchell <wence at gmx.li>





More information about the slime-devel mailing list