Hi everyone,

I've started playing with SWT + Clojure (I know very little about SWT  
and I've just started out with Clojure, so please bear with me) and I  
would like to get it going from within Aquamacs Emacs + SLIME. I'm not  
sure if this is a real Clojure question or more of a Cocoa/Carbon  
specific thing, but since many are using Aquamacs Emacs as a Clojure  
IDE someone may have already seen this.

I'm using Java 1.6 and I've built swt.jar from Eclipe CVS, using  
org.eclipse.swt.cocoa.macosx.x86_64 for the platform specific stuff.

I'm trying a very simple Hello World which runs fine when started from  
a terminal REPL, but from Aquamacs Emacs, it creates an empty window  
(it does't even draw the window borders) and then it just hangs (as if  
the event processing loop never starts). My *inferior-lisp* buffer  
spews a lot of complaints about no autorelease pool being present,  
like this one:

2009-06-09 08:32:01.844 java[4010:20a03] *** _NSAutoreleaseNoPool():  
Object 0x1001b1120 of class NSCFArray autoreleased with no pool in  
place - just leaking

Is it possible at all to run SWT Cocoa from Aquamacs+SLIME?



This is my script, cobbled together from bits and pieces I found online:

(ns main
   (:import (org.eclipse.swt.widgets Display Shell Label)
            (org.eclipse.swt SWT)))

(defn swt-loop [display shell]
   (loop []
         (if (.isDisposed shell)
           (.dispose display)
          (do
             (if (not (.readAndDispatch display))
               (.sleep display))
             (recur)))))

(defn do-it []
   (let [d (Display.)]
     (let [s (Shell. d)]
       (doto (Label. s SWT/CENTER)
         (.setText "Hello World!")
         (.setBounds (.getClientArea s)))
       (.open s)
       (swt-loop s d))))

(do-it)

And here's a command that's equivalent to what I run as a clojure- 
swank-binary:

java -cp clojure-1.0.0.jar:clojure-contrib.jar:swt.jar -server -d64 \
    -XstartOnFirstThread -Xdebug \
    -Xrunjdwp:transport=dt_socket,server=y,suspend=n clojure.main


Many thanks!
gert



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to