[slime-devel] Parsing the in-package form

Antonio Menezes Leitao aml at gia.ist.utl.pt
Wed Nov 22 21:25:52 UTC 2006


Hi,

If I'm not mistaken, the current Slime version doesn't correctly parse
in-package forms when the package name is a string or a keyword.  This
can be easily seen by writing in an edit buffer

(in-package :foo)

or 

(in-package "FOO")

and then pressing C-c M-p (slime-repl-set-package)

The following replacement correct this behaviour.

(defun slime-search-buffer-package ()
  (save-excursion
    (when (let ((case-fold-search t)
                (regexp "^(\\(cl:\\|common-lisp:\\)?in-package\\>[ \n\t\r':\"]*"))
            (or (re-search-backward regexp nil t)
                (re-search-forward regexp nil t)))
      (goto-char (match-end 0))
      (let ((start (point)))
        (let ((pkg (ignore-errors (read (current-buffer)))))
          (and pkg (format "%S" pkg)))))))

Best regards,

António Leitão.



More information about the slime-devel mailing list