Commits

sk  committed 9c14b9f

Added creation of repl thread after swank startup.

  • Participants
  • Parent commits 0140fa6

Comments (0)

Files changed (4)

File src/org/lispdev/swank/BaseLocalLispLaunchDelegate.java

   public final static String ATTR_ENV = ILaunchManager.ATTR_ENVIRONMENT_VARIABLES;
   public final static String ATTR_PORT = "port-int";
   public final static String ATTR_EXT = "lisp-extensions-path-string";
+  public final static String ATTR_START_REPL_THREAD = "start-repl-thread";
   //for now to folder containing lisp-extensions folder: see basicStartup
   //function in SwankInterface
 
       new LocalLispImplementation(exe, swankDir,
           config.getAttribute(ATTR_CMD_PARAMS, new ArrayList()),
           config.getAttribute(ATTR_ENV, new HashMap()),
-          port);
+          port, config.getAttribute(ATTR_START_REPL_THREAD, false));
     final String ext = config.getAttribute(ATTR_EXT, "");
     final File extf = new File(ext);
     if( !extf.isDirectory() )

File src/org/lispdev/swank/LispImplementation.java

   }
 
   /**
+   * @return true if need to explicitly to start repl thread
+   */
+  public abstract boolean startReplThread();
+
+  /**
    * Starts lisp process and starts swank server at correct port.
    * All parameters, including port, should be set in constructor.
    * @return running lisp process (can be null if remote?)

File src/org/lispdev/swank/LocalLispImplementation.java

   private final String[] commandLine;
   @SuppressWarnings("rawtypes")
   private final Map env;
+  private final boolean startReplThread;
 
   @SuppressWarnings("rawtypes")
   public LocalLispImplementation(String exePath, String swankDir, List cmdParams,
-      Map env, int port)
+      Map env, int port, boolean startReplThread)
   {
     super(port);
     commandLine = new String[3+cmdParams.size()];
       commandLine[i+3] = String.valueOf(cmdParams.get(i));
     }
     this.env = (env == null ? new HashMap<String,String>() : env);
+    this.startReplThread = startReplThread;
   }
 
   @Override
     return lispEngine;
   }
 
+  @Override
+  public boolean startReplThread()
+  {
+    return startReplThread;
+  }
+
 }

File src/org/lispdev/swank/SwankInterfaceCore.java

       }
     }
 
-    // sendRaw("(:emacs-rex (swank:connection-info) nil t 1)");
     if( echoSocket != null && echoSocket.isConnected() )
     {
       System.out.println("----------------connected");
       System.out.println("----------------not connected");
       connected = false;
     }
+    if( implementation.startReplThread() )
+    {
+      LispNode res =
+        sendEvalAndGrabRawWithThread("(swank:create-repl nil)",
+            "COMMON-LISP-USER", "t", 2000);
+      if( res == null )
+      {
+        System.out.println("------------could not start repl thread");
+      }
+    }
     return connected;
   }
 
     return callBack;
   }
 
-  public LispNode sendEvalAndGrabRaw(String message, String pkg, long timeout)
+  private LispNode sendEvalAndGrabRawWithThread(String msg, String pkg,
+      String thread, long timeout)
   {
     SyncCallback callBack = getSyncCallBack();
 
     {
       synchronized(callBack)
       {
-        if( emacsRex(message, pkg) )
+        if( emacsRexWithThread(msg, pkg, thread) )
         {
           callBack.wait(timeout);
           return callBack.result.getf(":return").getf(":ok");
     } // catch
   }
 
+  public LispNode sendEvalAndGrabRaw(String message, String pkg, long timeout)
+  {
+    return sendEvalAndGrabRawWithThread(message, pkg, ":repl-thread", timeout);
+  }
+
   public synchronized void sendEvalRaw(String msg, SwankRunnable callBack)
   {
     registerCallback(callBack);