All Manuals > LispWorks User Guide and Reference Manual > 7 Dspecs: Tools for Handling Definitions > 7.9 Users of location information


7.9.5 Example: defcondition

Suppose you have a macro based on define-condition :

(defmacro defcondition (&rest args)
  `(define-condition ,@args))

When the following form is evaluated, the system records the dspec (define-condition foo):

(defcondition foo () ())

Two setups are needed to allow the editor to locate such a defining form.

Firstly, this tells the system how to parse (defcondition ...) toplevel forms:

     (:alias define-condition)))

So now:

(dspec:parse-form-dspec '(defcondition foo () ()))
(defcondition foo)

Secondly, this tells the system that (defcondition foo) is an alias for (define-condition foo).

With this, the editor would report "Cannot find (DEFINE-CONDITION FOO) in ...".

(dspec:define-dspec-alias defcondition (name)
  `(define-condition ,name))

So now this definition can be located:

(defcondition foo () ())

just as if it were:

(define-condition foo () ())

LispWorks User Guide and Reference Manual - 21 Dec 2011