[Openmcl-devel] Disabling the listener in when you build an applicaiton

Paul Krueger plkrueger at comcast.net
Sun Aug 29 11:54:38 UTC 2010

I'm currently working on an extension to my interface contrib stuff (.../ccl/contrib/krueger/InterfaceProjects/...) that will add all sorts of support for creating stand-alone Lisp apps. It's still a few months off however. So far I have created support for a new Lisp class slot option to support the Key-Value Observing protocol with just a slot declaration, a new NSBundle subclass that knows how to load Lisp files, support for swapping different menu items easily to support debugging under the IDE prior to creating a stand-alone app, a new window to support the build-application specification including specification of a new app proxy and/or top-level function and editing the app's info.plist. And I have a whole bunch of type-translation functions for easily converting between NSObjects like Dictionaries and Arrays to corresponding Lisp types like hash tables and arrays. 

Stay tuned.


On Aug 29, 2010, at 4:01 AM, Gary Byers wrote:

> A listener pops up on startup (and, on OSX, when the application is
> activated when no other windows are present) in the IDE because the
> IDE is a document-based application and document-based applications
> are supposed to create a new document in those situations.  (There's
> a little bit of an argument for creating a new editor window in those
> cases, but the argument for creating a listener seems to be stronger.)
> There isn't an explicit option to BUILD-APPLICATION that suppresses
> this behavior, just as there aren't thousands of explicit options
> to control the thousands of ways that an application's behavior might
> differ from the IDE's.
> BUILD-APPLICATION does provide options that let you specify this; some
> of that's done declaratively (in the info-plist) and some of it needs
> to be done procedurally (by defining classes and methods on those classes
> that implement application-specific behavior.)
> A lot of a Cocoa application's "application-specific behavior" is implemented
> by the global (NS)Application object's delegate; it should be easier than
> it is to use BUILD-APPLICATION or some similar tool to arrange that an instance
> of some specified, user-defined class will be instantiated and made to be the
> application's delegate on startup.  You currently have to jump through some
> hoops and ... um, mess with some low-level code in order to do this:
> ;;; For no apparent reason, the value of GUI::*DEFAULT-NS-APPLICATION-PROXY-CLASS-NAME*
> ;;; is initialized every time that the IDE starts up.  Its value is just a lisp
> ;;; string (the ObjC class name of the application delegate's class), and it should
> ;;; be possible/easy to override the default.
> (setq ccl::*lisp-system-pointer-functions*
>              ccl::*lisp-system-pointer-functions*
>              :key #'ccl::function-name))
> If it were the case that you wanted your application to behave just like the
> IDE except for this listener-creation behavior, you could then do:
> (defclass my-lisp-application-delegate (gui::lisp-application-delegate)
>  ()
>  (:metaclass ns:+ns-object))
> (setq GUI::*DEFAULT-NS-APPLICATION-PROXY-CLASS-NAME* "MyLispApplicationDelegate")
> And, depending on what behavior you want, you could either tell the Cocoa runtime that this business of opening untitled documents on startup doesn't
> really apply to you:
> (objc:defmethod (#/applicationShouldOpenUntitledFile: #>BOOL)
>    ((self my-lisp-application-delegate) app)
>  (declare (ignore app))
>  nil)
> or override requests to open a document on startup/reactivation:
> (objc:defmethod (#/applicationOpenUntitledFile: #>BOOL)
>    ((self my-lisp-application-delegate) app)
>    (maybe-open-something app)
>    (if (opened-something)
>      t
>      nil))
> I suspect that this isn't the only thing that you'd want to customize.
> (the "about" box, the "bundle identifier" - used to name preference
> files, among other things -, the types of files/documents your application
> manipulates and how it does so, application/document icons, other behaviors.)
> BUILD-APPLICATION helps a little in dealing with this.  It could certainly
> help more than it does, but I don't think that application generation is
> ever likely to be a matter of picking the right combination of options or
> keyword arguments from some sort of menu.
> On Fri, 27 Aug 2010, Michael Minerva wrote:
>> I am trying to create an end user mode and I cannot find anywhere in the documentation for build-applicaiton where you can tell the listener to not pop up.  Is there anyway to do this without hacking around with low level ccl methods?
>> -Mike
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> http://clozure.com/mailman/listinfo/openmcl-devel
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

More information about the Openmcl-devel mailing list