Hi,
I have not much time to write right now but there is a new version and I want to inform you about it so that you do not spend thought on things that are already changed.
I've had a discussion with Timothy Moore in #lisp. His idea has been:
<moore33> mgr: I mean that launch-application could be a generic function that does what the code generated by your macro does, with all the flexibility that implies. Not that I care very much, but these days I tend to think about protocols before I think about macros.
(The discussion is logged, here is a direct link: http://meme.b9.com/cview.html?channel=lisp&utime=3347129927#utime_reques... )
Afterwards I have rewritten the stuff in clim-utilities.lisp; please, have a look at the file in the attached archive or at: http://matroid.org/flux/clim-launcher/clim-utilities.lisp
(The archive i is also in my public flux directory http://matroid.org/flux/ as clim-launcher-20060125-01.tar.bzip2 (or newer).)
Now there is the generic function LAUNCH-APPLICATION, the most generic method of it consists basically of the code the previous version of the DEFINE-APPLICATION-STARTER macro has generated, only more general.
You can know just execute (climi::launch-application 'climacs-gui:climacs :new-process t) to start Climacs, without the need to define a custom starter function. In this case you have to announce your application manually with something like: (clim-launcher:add-application "Climacs" ;; (See [1].) (lambda () (climacs-gui::climacs :new-process t)))
To create a custum starter function nevertheless, DEFINE-APPLICATION-STARTER does still exist, although it has been changed to use LAUNCH-APPLICATION. (It will still announce the application by default, of course.)
Using a generic method has the huge benefit that the starter can now be modified for each application frame. Think of Beirc, which wants to make a separate thread for the IRC connection on its start-up.
Another example is Clouseau that needs an object to inspect as an argument. We can now modify LAUNCH-APPLICATION and put the argument :object into the (also new) ARGUMENTS-FOR-APPLICATION-FRAME-CREATION argument for the generic LAUNCH-APPLICATION method:
-- zipp --
;;; Clouseau example (in-package :clouseau)
(climi::define-application-starter inspector :function-name inspector)
(in-package :climi)
(defmethod launch-application :around ((application-frame-name (eql 'clouseau::inspector)) &rest rest &key arguments-for-application-frame-creation &allow-other-keys) "This method will put the :OBJECT argument into :ARGUMENTS-FOR-APPLICATION-FRAME-CREATION" (let ((object (getf rest :object))) (when object (setf (getf arguments-for-application-frame-creation :obj) object ;; ensure that its in the list: (getf rest :arguments-for-application-frame-creation) arguments-for-application-frame-creation))) ;; call the real thing (apply #'call-next-method application-frame-name rest))
-- zapp --
We can now start Clouseau with (climi::launch-application 'clouseau:inspector :new-process t :object 'dudel) or via the custom generated function (clouseau:inspector :object 'tada :new-process t)
Comments are welcome. Bye, Max
1) The name ADD-APPLICATION should be renamed as well. I like ANNOUNCE-APPLICATION, but how will DELETE-APPLICATION then be called? Perhaps we should take REGISTER-APPLICATION and DEREGISTER-APPLICATION, although I prefer "announce"..