Function: dired-get-file-for-visit

dired-get-file-for-visit is an interactive and byte-compiled function defined in dired.el.gz.

Signature

(dired-get-file-for-visit)

Documentation

Get the current line's file name, with an error if file does not exist.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defun dired-get-file-for-visit ()
  "Get the current line's file name, with an error if file does not exist."
  (interactive)
  ;; We pass t for second arg so that we don't get error for `.' and `..'.
  (let ((raw (dired-get-filename nil t))
	file-name)
    (if (null raw)
	(user-error "No file on this line"))
    (setq file-name (file-name-sans-versions raw t))
    (if (file-exists-p file-name)
	file-name
      (if (file-symlink-p file-name)
	  (error "File is a symlink to a nonexistent target")
        (error (substitute-command-keys
                (concat "File no longer exists; type \\<dired-mode-map>"
                        "\\[revert-buffer] to update Dired buffer")))))))