[slime-devel] Re: Broken readtables
Martin Simmons
martin at xanalys.com
Thu Jun 17 11:08:24 UTC 2004
>>>>> On Thu, 17 Jun 2004 18:56:58 +1000, Alain.Picard at memetrics.com said:
ap> Luke Gorrie writes:
>> Alain.Picard at memetrics.com writes:
>>
>> > I have a file which defines a readtable so I can type
>> > things like #v(1 2). (Don't ask. :-)
>> >
>> > When I hit M-. to find any definition in this file, emacs
>> > croaks and asks if I want to enter recursive edit. Saying
>> > yes yields a SLDB buffer like this:
>>
>> The `with-standard-io-syntax' in dspec-stream-position looks
>> suspicious to me (swank-lispworks.lisp). How about if you remove it?
>>
ap> If you remove it, it works. In fact, I think there are TWO bugs
ap> in that function; I think that *read-eval* needs to be set to T.
It was bound it to NIL to prevent unexpected evaluation -- it depends on how
dangerous you want M-. to be :-)
#.(call-system "rm -rf /")
ap> I propose:
ap> (defun dspec-stream-position (stream dspec)
ap> (let ((*read-eval* t))
ap> (loop (let* ((pos (file-position stream))
ap> (form (read stream nil '#1=#:eof)))
ap> (when (eq form '#1#)
ap> (return nil))
ap> (labels ((check-dspec (form)
ap> (when (consp form)
ap> (let ((operator (car form)))
ap> (case operator
ap> ((progn)
ap> (mapcar #'check-dspec
ap> (cdr form)))
ap> ((eval-when locally macrolet symbol-macrolet)
ap> (mapcar #'check-dspec
ap> (cddr form)))
ap> ((in-package)
ap> (let ((package (find-package (second form))))
ap> (when package
ap> (setq *package* package))))
ap> (otherwise
ap> (let ((form-dspec (dspec:parse-form-dspec form)))
ap> (when (dspec:dspec-equal dspec form-dspec)
ap> (return pos)))))))))
ap> (check-dspec form))))))
ap> in swank-lispworks.lisp.
I made it use WITH-STANDARD-IO-SYNTAX originally to get all the standard
bindings, in particular you must also bind *PACKAGE* because the function sets
it. There is also *READ-BASE*, *READ-DEFAULT-FLOAT-FORMAT* and
*READ-SUPPRESS* to consider.
What binds *READTABLE* when you do M-. anyway? It doesn't seem to be bound
for me when DSPEC-STREAM-POSITION is reached via FIND-DEFINITIONS-FOR-EMACS.
__Martin
More information about the slime-devel
mailing list