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

Re: eval-enqueue



At  1:34 AM 2/16/94 +0100, Tobias Kunze wrote:
>I wrote a nifty fred-command that simply takes a numeric arg
>(generated with the m/c-<digits> keys) and passes it to the
>current sexpr in whatever fred window you are.
>Everything's quite fine except the fact that my final
>eval-enqueue'ing of the modified sexpr (which, of course, has
>already been read from the fred buffer) doesn't update the
>globals +++ *** /// ...(and so forth) ... -.
>I can't use the ccl::selection-eval approach window-enqueue-region
>takes, since I have to pass a form that has already been read,
>not a selection stream. Moreover, I also can't peek at the
>techniques involved in it, since l1-readloop.lisp isn't included
>in the level-1 folder.
>
>Is there any usable entry point which allows an enqueue-eval'ed
>form to behave exactly like any other form entered through
>window-enqueue-region?

The secret is to call ccl::toplevel-print with a list of the
values returned from your form:

? (defun eval-enqueue-and-print (form)
    (eval-enqueue `(ccl::toplevel-print (multiple-value-list ,form))))
EVAL-ENQUEUE-AND-PRINT
? (eval-enqueue-and-print '(values 1 2 3))
((TOPLEVEL-PRINT (MULTIPLE-VALUE-LIST (VALUES 1 2 3))))
1
2
3
? (list * /)
(1 (1 2 3))
?