 
     (let ((log-warning-minimum-level 'error))
       ;; Don't show spurious warning message
-      (if sw:image-is-executable
-	  (sw:common-lisp sw:common-lisp-buffer-name
-			  sw:common-lisp-directory
-			  sw:common-lisp-image-file
-			  sw:common-lisp-image-arguments
-			  sw:common-lisp-host
-			  nil)
-	(sw:common-lisp sw:common-lisp-buffer-name
-			sw:common-lisp-directory
-			sw:common-lisp-image-name
-			sw:common-lisp-image-arguments
-			sw:common-lisp-host
-			sw:common-lisp-image-file
-			)))
+      (sw:common-lisp sw:common-lisp-buffer-name
+		      sw:common-lisp-directory
+		      sw:common-lisp-image-name
+		      sw:common-lisp-image-arguments
+		      sw:common-lisp-host
+		      sw:common-lisp-image-file))
     (goto-char (point-max))
     ))

  (setq sw:common-lisp-image-arguments
    (list "-L" (getenv "SOCKET_INIT_FILE"))))

;; The following is almost the same as the above. The difference is that
;; in the following we execute a Specware application (rather than run Lisp
;; with a Specware world);

(defun run-lisp-application ()
  (interactive)
  (setq sw:common-lisp-host "localhost")
  (setq-default sw::lisp-host sw:common-lisp-host)
;;
;; sw:common-lisp-directory is the directory in which the lisp subprocess will
;; be executed. It is defined in eli/fi-subproc.el with a default value nil
;; This seems to work fine under Unix/Linux but under Windows there is 
;; a "stringp, nil" error message. So we set it to "c:." to avoid the problem.
;;
  (setq sw:common-lisp-directory (getenv "LISP_DIRECTORY"))

;; Below we set a parameter sw:common-lisp-image-name. This is the name 
;; used by eli/fi-subproc.el for the Lisp executable. This is the application
;; we want to run.  The image file (in the ACL sense) or world, is bound 
;; to common-lisp-image-file. If the executable is produced by
;; generate-application, then typically, there will not be an ACL image file.

  (setq sw:common-lisp-image-name (getenv "LISP_EXECUTABLE"))
  (setq sw:common-lisp-image-file (or (and (boundp 'sw:common-lisp-image-file) sw:common-lisp-image-file)
				      (getenv "LISP_HEAP_IMAGE")))
  (setq sw:common-lisp-image-arguments
    (if *windows-system-p* '("+cm") nil)) ; see note above

  (let ((log-warning-minimum-level 'error))
    (if sw:image-is-executable
	(sw:common-lisp sw:common-lisp-buffer-name
			sw:common-lisp-directory
			sw:common-lisp-image-file
			sw:common-lisp-image-arguments
			sw:common-lisp-host
			nil)
      (sw:common-lisp sw:common-lisp-buffer-name
		      sw:common-lisp-directory
		      sw:common-lisp-image-name
		      sw:common-lisp-image-arguments
		      sw:common-lisp-host
		      sw:common-lisp-image-file))))


(defun run-plain-lisp (&optional sleep)
  (interactive)

(defvar lisp-emacs-interface-type)
(defvar *windows-system-p*)

(defvar *specware-lisp*) ; allegro, cmulisp, openmcl, sbcl, etc.
(defvar *specware-buffer-name*)
(defvar *specware4-dir)
(defvar *specware-home-directory*)

(defvar *lisp-image-extension*)
(defvar *lisp-executable-extension*)
(defvar *fasl-extension*)

(defvar sw:common-lisp-directory)
(defvar sw:common-lisp-image-name)
(defvar sw:common-lisp-image-file)
(defvar sw:common-lisp-image-arguments)
(defvar sw:common-lisp-host)
(defvar sw:common-lisp-buffer-name)
(defvar sw::lisp-host)


;; This is called to start Specware. 
;; It is invoked by a command-line argument to Xemacs, and spawns a Lisp process.

(defun run-specware4 (&optional in-current-dir?)
  (interactive "P")
  (if (inferior-lisp-running-p)
      (sw:switch-to-lisp t)
    (let* ((*specware4-dir (strip-final-slash
			    (sw::normalize-filename ; may rename "Program Files" to "Progra~1" etc.
			     (expand-file-name 
			      (if in-current-dir?
				  (if (stringp in-current-dir?)
				      in-current-dir?
				    default-directory)
				(concat (or (getenv "LISP_DIRECTORY") 
					    (getenv "SPECWARE4"))))))))
	   (bin-dir               (binary-directory *specware4-dir))
	   (default-sw-executable (sw::normalize-filename (expand-file-name (concat bin-dir "/Specware4." *lisp-executable-extension*))))
	   (default-sw-image      (sw::normalize-filename (expand-file-name (concat bin-dir "/Specware4." *lisp-image-extension*)))))

      ;; sw:common-lisp-buffer-name is defined in compat.el

      ;; sw:common-lisp-directory is the directory in which the lisp subprocess will
      ;; be executed. It is defined in eli/fi-subproc.el with a default value nil
      ;; This seems to work fine under Unix/Linux but under Windows there is 
      ;; a "stringp, nil" error message. So we set it to "c:." to avoid the problem.

      (setq sw:common-lisp-directory (concat *specware4-dir "/"))

      ;; Specware can be started in two ways. 
      ;;
      ;; One way is to start a generic Lisp augmented with a Specware image. 
      ;; The term "image" comes from Franz Allegro. 
      ;; (At Kestrel, an image is called a "world".)
      ;;
      ;; The other way is to create a new standalone executable application.
      ;;
      ;; ACL uses the primitive generate-application to create standalone applications.
      ;; This requires the Enterprise Edition of ACL, but has the advantage that
      ;; we can ship Specware to users who do not already have ACL installed.
      ;;
      ;; Below we set a parameter sw:common-lisp-image-name. Just to confuse things
