 	      read-symbol)))))
 
 (defun sw::get-symbol-at-point (&optional up-p)
-  (let ((symbol
-	 (cond
-	  ((looking-at "\\sw\\|\\s_\\|\\.")
-	   (save-excursion
+  (save-excursion
+    (when (and (member (char-syntax (following-char)) '(?_ ?>))
+	       (eq ?w (char-syntax (preceding-char))))
+      (forward-char -1))
+    (let ((symbol
+	   (cond
+	    ((looking-at "\\sw\\|\\s_\\|\\.")
 	     (while (looking-at "\\sw\\|\\s_\\|\\.\\||")
 	       (forward-char 1))
 	     (while (eq (char-after (- (point) 2)) ?-)
-			   (forward-char -2))
+	       (forward-char -2))
 	     (buffer-substring-no-properties
 	      (point)
 	      (progn (forward-sexp -1)
 		     (while (looking-at "\\s'")
 		       (forward-char 1))
-		     (while (member (char-before) '(?. ?:))
+		     (while (member (preceding-char) '(?. ?:))
 		       (forward-sexp -1))
-		     (point)))))
-	  (t
-	   (condition-case ()
-	       (save-excursion
+		     (point))))
+	    (t
+	     (condition-case ()
 		 (if up-p
 		     (let ((opoint (point)))
 		       (cond ((= (following-char) ?\()

				       (forward-char 1)
				       (forward-sexp 2)
				       (backward-sexp 1)))))))))
		 (while (looking-at "\\sw\\|\\s_\\|\\.")
		   (forward-char 1))
		 (if (re-search-backward "\\sw\\|\\s_\\|\\." nil t)
		     (progn (forward-char 1)
			    (buffer-substring-no-properties
			     (point)
			     (progn (forward-sexp -1)
				    (while (looking-at "\\s'")
				      (forward-char 1))
				    (point))))
		   nil))
	     (error nil))))))
    (when (member symbol '(":"))
      (setq symbol nil))
    (or symbol
	(if (and up-p (null symbol))
	    (sw::get-symbol-at-point)))))

;;;; Commands for finding Specware expressions
(defun sw:find-terms-of-type (name)

     (format "(specware-test::run-test-directories-rec %S)"
	     default-directory))))

;;; For Gnu Emacs. This will be already defined in xemacs
(defvar display-warning-suppressed-classes ())

;;; Isabelle Interface
(defun sw:convert-spec-to-isa-thy (non-recursive?)
  "Converts Spec to Isabelle/HOL theory.
