Emacs quick find (Visual Studio style)

Elisp code to get the same "fast find" as in Visual Studio: When the cursor is on a word, press Ctrl-f3 to automatically search for occurences of this word in the same file (if a region is defined when you press Ctrl-f3, the search is for the content of the region instead). Then, press f3 or shift-f3 to search backward of forward:

;; Visual Studio style "fast find":
;; Ctrl-f3 to search for the word at the point (or for the content of the region if one is defined)
;; Ctrl-Shift-f3 to search backward.
;; once a search is initiated, use Ctrl-F3 or f3 to search forward,
;; Ctrl-Shift-f3 or Shift-f3 to search backward.
(defun visualstudio-find-word (forward)
  (or mark-active
      ; following code borrowed from function current-word in /usr/share/emacs/21.4/lisp/simple.el
      (progn
        (let ((oldpoint (point)) (start (point)) (end (point)))
          (skip-syntax-backward "w_") (setq start (point))
          (goto-char oldpoint)
          (skip-syntax-forward "w_") (setq end (point))
          (if (and (eq start oldpoint) (eq end oldpoint))
              ;; Point is neither within nor adjacent to a word.
              (progn
                ;; Look for preceding word in same line.
                (skip-syntax-backward "^w_"
                                      (save-excursion (beginning-of-line)
                                                      (point)))
                (if (bolp)
                    ;; No preceding word in same line.
                    ;; Look for following word in same line.
                    (progn
                      (skip-syntax-forward "^w_"
                                           (save-excursion (end-of-line)
                                                           (point)))
                      (setq start (point))
                      (skip-syntax-forward "w_")
                      (setq end (point)))
                  (setq end (point))
                  (skip-syntax-backward "w_")
                  (setq start (point)))
                (goto-char start)
                (push-mark nil nil t)
                (goto-char end))
            (progn
              (goto-char start)
              (push-mark nil nil t)
              (goto-char end))))))
  (progn
    (let ((search (buffer-substring (region-beginning) (region-end))))
      (deactivate-mark)
      (isearch-mode forward nil nil nil nil)
      (setq isearch-string search
            isearch-message search
            isearch-case-fold-search nil))))

(defun visualstudio-find-next-word () (interactive)
  (visualstudio-find-word t))
(defun visualstudio-find-previous-word () (interactive)
  (visualstudio-find-word nil))

(global-set-key [f3] 'isearch-forward)
(global-set-key [S-f3] 'isearch-backward)
(global-set-key [C-f3] 'visualstudio-find-next-word)
(global-set-key [C-S-f3] 'visualstudio-find-previous-word)
(define-key isearch-mode-map [f3] 'isearch-repeat-forward)
(define-key isearch-mode-map [S-f3] 'isearch-repeat-backward)
(define-key isearch-mode-map [C-f3] 'isearch-repeat-forward)
(define-key isearch-mode-map [C-S-f3] 'isearch-repeat-backward)