[climacs-devel] execute-frame-command

Christophe Rhodes csr21 at cam.ac.uk
Fri Mar 24 14:27:24 UTC 2006


Hi,

The CLIM spec allows execute-frame-command to be called on a frame
from threads not associated with that frame, apparently to implement
cross-application scripting or something along those lines: for
instance, a file manager could send a user's request to edit a file to
an already-running text editor.

This means that execute-frame-command methods should not use special
variables such as *application-frame* and *standard-output*, as they
could be executed in the wrong thread: and indeed
execute-frame-command should not assume that anything has been
executed.  I think ESA and Climacs get the latter right but not the
former; with the following patch, I am able to do things like

  (sb-thread:make-thread (lambda () (climacs-gui::climacs)))
  (defvar *foo*)
  (sb-thread:interrupt-thread * (lambda () (setf *foo* *application-frame*)))
  (clim:execute-frame-command 
   *foo* `(climacs-gui::com-insert-parentheses 0 nil))

and watch the parens be inserted into the *scratch* buffer.  (Warning:
I haven't in fact done precisely this -- I have instead been running
climacs under the new mcclim "Null" backend and inspecting the data
structures themselves).

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: efc.diff
URL: <https://mailman.common-lisp.net/pipermail/climacs-devel/attachments/20060324/c84f8f99/attachment.ksh>
-------------- next part --------------

I'm not able to do really interesting things with this yet, because
many of the gsharp or esa commands don't take arguments but instead
prompt (accept) explicitly.  Why was it done this way?  My hypothesis
is that it's done this way so that we don't overrun the minibuffer:
hitting RET doesn't cause some accepting-values dialog to pop up or
similar.  I mentioned this on IRC to Tim Moore, and he mumbled
something about *partial-command-parser*: I think his idea is that we
should bind that (and possibly also *command-parser*) to get the
minibuffer behaviour we want, and then the commands' arglists should
reflect all the information needed from the user.

Does that make any sense?

Cheers,

Christophe

PS: My kingdom for only one copy of ESA...


More information about the climacs-devel mailing list