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

Calling Zmacs from Lisp



    Date: Fri, 16 Mar 90 08:41 EST
    From: WJL@ZERMATT.lcs.mit.edu (Bill Long)
    
    Does anyone know how to invoke more general calls to "ed" or the
    equivalent of a tag search from outside of Zmacs?  I have a knowledge
    base file with forms that look like:
    
    (defnode foo ...)
    
    (defnode (foo bar) ...)
    
    I can quickly go to edit the first kind with (ed 'foo), however, there
    doesn't seem to be any way to get to the second kind from outside of
    Zmacs.

Well, does the editor understand your DEFNODE forms?  You can find out
by doing m-X List Definitions in a buffer containing these forms.  If it
doesn't, you should tell it how to parse these forms, by putting
ZWEI:DEFINITION-FUNCTION-SPEC-TYPE, ZWEI:DEFINITION-FUNCTION-SPEC-PARSER,
ZWEI:DEFINITION-FUNCTION-SPEC-FINDER, or SI:DEFINITION-TYPE-NAME properties
onto your symbol DEFNODE.  To see what these properties should be, look
at the property lists of some of the other DEFxxx symbols; you might
possibly be able to just copy an existing -PARSER or -FINDER rather than
writing your own.

If the editor understands your forms then m-. can find them, and if m-.
can find them then ED can find them.

Once the editor understands your forms, the most general form of call
to ED to edit a definition is (ED '(ZWEI:EDIT-DEFINITION name types)),
where name is the name of the definition as either a Lisp object (symbol
or list) or as a string that could be typed to m-., and types is a list
of allowed definition types, or the empty list to allow all definition
types.  Definition types are like DEFUN, DEFVAR, DEFTYPE.  You might
want to make DEFNODE its own definition type if it doesn't fit any
of the existing ones (use the SI:DEFINITION-TYPE-NAME property).  You
can make an EDNODE function that calls ED the way you want, if you wish.

To see how the argument to ED is processed, see ZWEI:EDIT-THING.  There
are dozens of other options.

I'm not sure if definition names that are lists (rather than symbols)
are supported for definition types other than DEFUN.  You didn't
make it clear whether the name of your second example was considered
to be FOO, BAR, or (FOO BAR).