[slime-devel] SLIME's readline problem?

亀田馬志 masashi.kameda at gmail.com
Thu Apr 29 14:23:17 UTC 2010


Hi.

I saw something strange about SLIME and tried googling about it. But
couldn't find any clues.
Please allow me to post here.

I read "Let Over Lambda", a book about macros, and noticed function, named
with "!", on a file couldn't be recognized nor compiled through using SLIME.

The codes are listed below, using some utilities from the book "On Lisp",
written by Paul Graham.

;; *-SIMBOL-P-GENERATOR
> ;; (defmacro *-symbol-p-generator (str)
> ;;   (let ((len (1+ (length str)))
> ;;     (init-part (string-upcase str)))
> ;;     `(defun ,(intern (concatenate 'string init-part "-SYMBOL-P")) (s)
> ;;        (and (symbolp s)
> ;;         (> (length (symbol-name s)) ,len)
> ;;         (string= (symbol-name s)
> ;;              ,init-part
> ;;              :start1 0
> ;;              :end1 ,len)))))
>
> ;; G-BANG-SYMBOL-PREDICATE
> ;; (*-symbol-p-generator "g!")
>
> (defun g!-symbol-p (s)
>   (and (symbolp s)
>        (> (length (symbol-name s)) 2)
>        (string= (symbol-name s)
>         "G!"
>         :start1 0
>         :end1 2)))
>
> ;; DEFMACRO-WITH-G-BANG!
> (defmacro defmacro/g! (name args &body body)
>   (let ((syms (remove-duplicates
>            (remove-if-not #'g!-symbol-p
>                   (flatten body)))))
>     `(defmacro ,name ,args
>        (let ,(mapcar
>           (lambda (s)
>         `(,s (gensym ,(subseq
>                    (symbol-name s)
>                    2))))
>           syms)
>      , at body))))
>
> ;; ONCE-ONLY
> (defmacro once-only ((&rest names) &body body)
>   (let ((gensyms (loop for n in names collect (gensym))))
>     `(let (,@(loop for g in gensyms collect `(,g (gensym))))
>        `(let (,,@(loop for g in gensyms for n in names collect ``(,,g
> ,,n)))
>       ,(let (,@(loop for n in names for g in gensyms collect `(,n ,g)))
>         , at body)))))
>
> ;; O-BANG-SYMBOLS
> ;; (*-symbol-p-generator "o!")
>
> (defun o!-symbol-p (s)
>   (and (symbolp s)
>        (> (length (symbol-name s)) 2)
>        (string= (symbol-name s)
>         "O!"
>         :start1 0
>         :end1 2)))
>
> (defun o!-symbol-to-g!-symbol (s)
>   (symb "G!"
>     (subseq (symbol-name s) 2)))
>
> ;; DEFMACRO-BANG
> (defmacro defmacro! (name args &body body)
>   (let ((os (remove-if-not #'o!-symbol-p args)))
>     (let ((gs (mapcar #'o!-symbol-to-g!-symbol os)))
>       `(defmacro/g! ,name ,args
>      `(let ,(mapcar #'list `(,, at gs) `(,, at os))
>         ,(progn , at body))))))
>
> ;; NIF
> (defmacro! nif (o!expr pos zero neg)
>   `(cond ((plusp ,g!expr) ,pos)
>      ((zerop ,g!expr) ,zero)
>      (t ,neg)))
>

>
;;; This  is the end of file
>

C-c C-k shows such a message below.

; in: DEFMACRO! NIF
> ;     (DEFMACRO! NIF (O!EXPR POS ZERO NEG)
> ;                `(COND ((PLUSP ,G!EXPR) ,POS) ((ZEROP ,G!EXPR) ,ZERO) (T
> ,NEG)))
> ;
> ; caught ERROR:
> ;   (during macroexpansion of (DEFMACRO! NIF ...))
> ;   The function O!-SYMBOL-P is undefined.
> ;
> ; compilation unit finished
> ;   caught 1 ERROR condition
>
> ; /home/cametan/lol.chapter_2.fasl written
> ; compilation finished in 0:00:00.091
>

Strange. The function O!-SYMBOL-P was THERE on the file.

So I check sbcl repl directly on my bash; in that case, the file could be
loaded and compiled without any problem.
Therefore, SLIME must have the problem.

Actually, if I made the function on REPL on SLIME, NO PROBLEM. The problem
is occured when I made a file, load, and compile THE FILE.

I checked the file, then I found both g!-symbol-p and o!-symbol-to-g!-symbol
are not recognized by SLIME, either. Then, I concluded functions with "!"
are not recognized by SLIME.

Is there any solution about that? I use Ubuntu 9.10, SBCL and Emacs 23
provided by Ubuntu. Also I use cvs version of SLIME(newest).

Here are my lines about SLIME on my .emacs

;;=======================================================================
> ;; SLIME
> ;;=======================================================================
> (setq inferior-lisp-program "/usr/bin/sbcl")
> (add-to-load-path-recompile
>  (expand-file-name "~/slime"))
> (add-hook 'lisp-mode-hook (lambda ()
>                 (inferior-slime-mode t)
>                 (global-set-key "\C-cH" 'hyperspec-lookup)
>                 (push 'ac-source-slime ac-sources)
>                 (auto-complete-mode)))
>
> (require 'slime)
>
> (eval-after-load "slime"
>   '(progn
>     (message "Slime configuration...")
>     (slime-setup '(slime-scratch
>            slime-editing-commands
>            slime-fancy
>            slime-repl
>            slime-asdf
>            anything-slime)))
>   )
> ;;
>
 (setq slime-net-coding-system 'utf-8-unix
>       ;; inferior-lisp-program "/usr/bin/sbcl"
>       lisp-indent-function 'common-lisp-indent-function
>       slime-complete-symbol*-fancy t
>       slime-complete-symbol-function 'slime-fuzzy-complete-symbol
>       slime-startup-animation t)
>
> (slime-autodoc-mode)
> ;;
>


Thanks

cametan

P.S. I also found SLIME's REPL don't recognized reader macros. Though making
reader macro with #foo, SLIME says something like "incomplete input".
P.S.2. The author of LOL says he hates Emacs. Then, if he spelled and cursed
SLIME, I would give all up.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20100429/0669be39/attachment.html>


More information about the slime-devel mailing list