     (select-window (posn-window (event-end event)))
     (find-file-other-window (file-name-sans-versions file t))))
 
-;; But be aware that `dired-sort-menu.el' binds `S-mouse-2' to `dired-sort-menu-popup'.
-;;
-;;;###autoload
-(defun diredp-mouse-find-file (event)   ; Bound to `S-mouse-2'
-  "Replace Dired in its window by this file or directory."
-  (interactive "e")
-  (let (file)
-    (with-current-buffer (window-buffer (posn-window (event-end event)))
-      (save-excursion (goto-char (posn-point (event-end event)))
-                      (setq file  (dired-get-filename nil t))))
-    (unless (stringp file) (error "No file here"))
-    (select-window (posn-window (event-end event)))
-    (find-file (file-name-sans-versions file t))))
-
 ;;;###autoload
 (defun diredp-mouse-view-file (event)   ; Not bound
   "Examine this file in view mode, returning to Dired when done.

(defvar bookmark-default-file)                    ; In `bookmark.el'
(defvar compilation-current-error)                ; In `compile.el'
(defvar delete-by-moving-to-trash)                ; Built-in, Emacs 23+
(defvar dired-details-state)                      ; In `dired-details+.el'
(defvar dired-keep-marker-hardlink)               ; In `dired-x.el'
(defvar dired-recursive-deletes)                  ; In `dired.el', Emacs 22+

;; for selecting (marking) files.
(define-key dired-mode-map [S-mouse-1] 'diredp-mouse-mark-region-files)     ; `S-mouse-1'
(define-key dired-mode-map [mouse-2] 'dired-mouse-find-file-other-window)   ; `mouse-2'
;; But be aware that `dired-sort-menu.el' binds `S-mouse-2' to `dired-sort-menu-popup'.
(define-key dired-mode-map [S-down-mouse-2] 'dired-mouse-find-file)         ; `S-mouse-2'
(define-key dired-mode-map [S-mouse-2] 'ignore)
(define-key dired-mode-map [M-mouse-2] 'diredp-mouse-find-file-other-frame) ; `M-mouse-2'

