Re: slime maybe-method-location

"bryan o'connor" <[email protected]> Sat, 13 Aug 2005 23:43:21 -0700
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>
i think i basically understand what's going on.  one way to
fix it:

import ccl::funcallable-standard-class into swank-mop and add
it to the etypecase in specializer-name.

the eql-specializer case needs to insert a #\' into the cons.
something like this:
   (swank-mop:eql-specializer `(eql ',(swank-mop:eql-specializer- 
object spec)))

the last thing, and this is where my emacs regexp knowledge
fails me, is that the resulting regexp generated in slime.el
needs to have the parentheses escaped (or removed).

the regexp used by re-search-forward is something like this:
   "\\s *(def\\(\\s_\\|\\sw\\)*\\s +DOCUMENTATION\\>.+?\\<SYMBOL\\>.+? 
\\<(EQL  STRUCTURE)\\>"

no #\' and un-escaped parentheses.  it should be:

   "\\s *(def\\(\\s_\\|\\sw\\)*\\s +DOCUMENTATION\\>.+?\\<SYMBOL\\>.+? 
\\<\\(EQL 'STRUCTURE\\)\\>"

it might be nice for that regexp to also allow a newline between
the method name and each qualifier.


         ..bryan


On Aug 13, 2005, at 9:35 PM, Alan Ruttenberg wrote:

> Here's the story:
>
> In order to find the location of a method by doing a text search,  
> you need to get enough information to reconstruct what the  
> defmethod would look like, given the method object. Otherwise you  
> look for def* <method name> which gives the behaviour Gary observes  
> - wrong method found more likely than not.
>
> So you need to get the qualifiers and specializers and pass them on  
> to swank to construct a regexp from.
>
> The initial version of this function looked like:
>
> (defun maybe-method-location (type)
>   (when (typep type 'ccl::method)
>     `((method ,(ccl::method-name type)
>               ,(ccl::method-specializers type)
>               ,@(ccl::method-qualifiers type))
>       ,(function-source-location (ccl::method-function type)))))
>
> At some point Marco changed a bit of this to:
>
> (mapcar #'specializer-name (ccl::method-specializers type))
>
> (if Marco is reading this, do you remember why you made this change?)
>
> and defined
>
> (defun specializer-name (spec)
>    (etypecase spec
>      (cons spec)
>      ((or swank-mop:standard-class built-in-class) (swank-mop:class- 
> name spec))
>      (swank-mop:eql-specializer `(eql ,(swank-mop:eql-specializer- 
> object spec)))))
>
> This is buggy, since it doesn't cover all specializers.
>
> At some later point I think I added structure-class to the typecase  
> to fix one case.
>
> So this function is what needs to be fixed. (still haven't paged in  
> enough in to fix it. later)
>
> -Alan
>
> On Aug 13, 2005, at 5:51 PM, Gary Byers wrote:
>
>
>>
>>
>> On Sat, 13 Aug 2005, bryan o'connor wrote:
>>
>>
>>
>>> the problems seem to arise from the call to
>>> swank-backend::maybe-method-location.  removing that
>>> from find-definitions seems to work.
>>>
>>>
>>
>> SWANK::MAYBE-METHOD-LOCATION calls SWANK::FUNCTION-SOURCE-LOCATION
>> which calls CCL::EDIT-DEFINITION-P, which tries (in the DOCUMENTATION
>> case) to call CLASS-NAME on an EQL specializer, and that signals
>> an error.
>>
>>
>>
>
>