[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Undefining



I need a command to undefine the function or method that the point is
sitting in (or after).  This is not terribly useful for functions
unless I am trying to save space.  But it is a real pain to remove an
erroneously defined method and it often needs to be removed to have
things work correctly (e.g. changing a primary method to an after
method) and it happens often enough that a simplification would help
alot.  Here is as close as I've come.

(defun my-remove-method (generic-function-name qualifier 
	                   &rest specializer-class-names)
  (let* ((func (symbol-function generic-function-name))
         (method (find-method func qualifier 
                              (mapcar 'find-class specializer-class-names))))
    (remove-method func method)
    ))

If I can recall how to call this bugger, I get the job done after
lots of typing.  It would be great if a command could look at the defmethod
I am currently in, get the right arguments, and call my-remove-method
for me.  Doesnt sound too hard, but my fred programming skills are as
yet undeveloped.

The concept could be extended (if the above is too easy) to undefine
(or un*) all sorts of things, depending on what point is in.

Dan LaLiberte
liberte@cs.uiuc.edu
(Join the League for Programming Freedom: league@prep.ai.mit.edu)