     (let* ((file-uid (sw::file-to-specware-unit-id buffer-file-name relativise))
 	   (match (sw:re-search-backward sw:basic-unit-intro-regexp)))
       (if match
-	  (concat file-uid "#" (match-string 1))
+	  (concat file-uid "#" (match-string-no-properties 1))
 	file-uid))))
 
 (when (and (not (featurep 'xemacs)) (not (fboundp 'replace-in-string)))

				       (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)

	      read-symbol)))))

(defun sw::get-symbol-at-point (&optional up-p)
  (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))
	     (buffer-substring-no-properties
	      (point)
	      (progn (forward-sexp -1)
		     (while (looking-at "\\s'")
		       (forward-char 1))
		     (while (member (preceding-char) '(?. ?:))
		       (forward-sexp -1))
		     (point))))
	    (t
	     (condition-case ()
		 (if up-p
		     (let ((opoint (point)))
		       (cond ((= (following-char) ?\()
