   ;; Works only when point is at the beginning of a type (modulo
   ;; initial spaces/comments).
   (scala-forward-spaces)
-  (when (looking-at "\\<class\\>") (forward-word 1) (scala-forward-spaces))
+  (scala-when-looking-at "\\<class\\>"
+                         (forward-word 1) (scala-forward-spaces))
   (scala-forward-simple-type)
-  (while (looking-at "\\s *\\<with\\>\\s *")
-    (goto-char (match-end 0))
+  (while (scala-when-looking-at "\\s *\\<with\\>\\s *")
     (if (and (not (eobp)) (= (char-after) ?\{))
         (forward-sexp)                       ;skip refinement
       (scala-forward-simple-type)))

(require 'cl)
(require 'regexp-opt)

(defconst scala-mode-version "0.2 ($Revision$)")
(defconst scala-bug-e-mail "Michel.Schinz@epfl.ch")
(defconst scala-web-url "http://lampwww.epfl.ch/scala/")


    ;; functions
    (,(concat "\\(^\\|[^(,]\\)\\s *\\<def\\>" "\\s *" "\\(" scala-ident-re "\\)\\s *")
     (2 font-lock-function-name-face nil)
     (scala-match-and-skip-type-param (goto-char (match-end 0)) nil
                                      (1 font-lock-type-face nil t))
     (scala-match-and-skip-binding nil nil
                                   (1 font-lock-variable-name-face nil)
                                   (2 font-lock-type-face nil t))
