   (set (make-local-variable 'company-backends) '(racer-company-complete)))
 
 (defun racer--syntax-highlight (str)
-  "Apply font-lock properties to a string of Rust code."
+  "Apply font-lock properties to a string STR of Rust code."
   (with-temp-buffer
     (insert str)
-    ;; Use rust-mode for syntax highlighting, but don't run any of its
-    ;; hooks.
-    (let ((rust-mode-hook))
-      (rust-mode))
+    (delay-mode-hooks (rust-mode))
     (font-lock-fontify-buffer)
-    (buffer-substring (point-min) (point-max))))
+    (buffer-string)))
 
 (defun racer--goto-func-name ()
   "If point is inside a function call, move to the function name.

  (let ((fname (get-text-property 0 'fname arg))
        (linenum (get-text-property 0 'linenum arg)))
    (cons fname (string-to-number linenum))))

(defun racer--complete-at-point-fn ()
  "Run the racer complete command and process the results."
  (let ((racer-tmp-file-name (make-temp-file "racer"))
        (racer-completion-results '()))
    (racer--write-tmp-file racer-tmp-file-name)
    (setenv "RUST_SRC_PATH" (expand-file-name racer-rust-src-path))
    (save-excursion
      (let ((lines (process-lines racer-cmd
                                  "complete"
                                  (number-to-string (racer-get-line-number))
                                  (number-to-string (current-column))
				  (buffer-file-name)
                                  racer-tmp-file-name))
            racer-start-pos
            racer-end-pos)
        (delete-file racer-tmp-file-name)
        (dolist (line lines)
          (when (string-match "^MATCH \\([^,]+\\),\\(.+\\)$" line)
            (let ((completion (match-string 1 line)))
              (push completion racer-completion-results)))

          (when (string-match "^PREFIX \\(.+\\),\\(.+\\),\\(.*\\)$" line)
            (setq racer-start-pos (string-to-number (match-string 1 line)))
            (setq racer-end-pos (string-to-number (match-string 2 line)))))
        (list (- (point) (- racer-end-pos racer-start-pos))
              (point)
              racer-completion-results)))))

(defun racer--company-annotation (arg)
  "Gets and formats annotation data from the arg match."

  (if (company-manual-begin)
      (company-complete-common)
    (indent-for-tab-command)))

;;;###autoload
(defun racer-find-definition ()
