   (interactive "P")
   (save-buffer)
   (let* ((buf-name buffer-file-name)
-	 (filename (sw::file-to-specware-unit-id buf-name t))
+	 (filename (sw:containing-specware-unit-id t))
 	 (dir default-directory))
     (lisp-or-specware-command ":swl " "gen-lisp-top " filename)
     (when compile-and-load?

		 sym)))
      (let ((results (sw:eval-in-lisp (make-search-form qualifier sym)))
            (current (cons "Op" (if buffer-file-name
                                    (sw::file-to-specware-unit-id buffer-file-name nil)
                                  ""))))
	(message nil)
	(setq results (if (member results '(nil NIL Error:))


(defun sw:cl-unit (unitid)
  (interactive (list (read-from-minibuffer "Compile and Load Unit: "
					   (sw:containing-specware-unit-id t))))
  (save-buffer)
  (let ((temp-file-name (concat (temp-directory) "-cl-current-file")))
    (if (member (sw:eval-in-lisp
