Function: dnd-open-local-file

dnd-open-local-file is a byte-compiled function defined in dnd.el.gz.

Signature

(dnd-open-local-file URI ACTION)

Documentation

Open a local file.

The file is opened in the current window, or a new window if dnd-open-file-other-window is set. URI is the url for the file, and must have the format file:file-name or file:///file-name. The last / in file:/// is part of the file name. If the system natively supports unc file names, then remote urls of the form file://server-name/file-name will also be handled by this function. An alternative for systems that do not support unc file names is dnd-open-remote-url. ACTION is ignored.

Source Code

;; Defined in /usr/src/emacs/lisp/dnd.el.gz
(defun dnd-open-local-file (uri _action)
  "Open a local file.
The file is opened in the current window, or a new window if
`dnd-open-file-other-window' is set.  URI is the url for the file,
and must have the format file:file-name or file:///file-name.
The last / in file:/// is part of the file name.  If the system
natively supports unc file names, then remote urls of the form
file://server-name/file-name will also be handled by this function.
An alternative for systems that do not support unc file names is
`dnd-open-remote-url'.  ACTION is ignored."

  (let* ((f (dnd-get-local-file-name uri t)))
    (if (and f (file-readable-p f))
	(progn
	  (if dnd-open-file-other-window
	      (find-file-other-window f)
	    (find-file f))
          (file-name-history--add f)
	  'private)
      (error "Can not read %s" uri))))