Function: ffap-read-file-or-url

ffap-read-file-or-url is a byte-compiled function defined in ffap.el.gz.

Signature

(ffap-read-file-or-url PROMPT GUESS)

Documentation

Read file or URL from minibuffer, with PROMPT and initial GUESS.

Source Code

;; Defined in /usr/src/emacs/lisp/ffap.el.gz
(defun ffap-read-file-or-url (prompt guess)
  "Read file or URL from minibuffer, with PROMPT and initial GUESS."
  (let ((elem (cons ffap-url-regexp #'ffap--url-file-handler)))
    (unwind-protect
        (progn
          (push elem file-name-handler-alist)
          (if (ffap-url-p guess)
              (read-file-name prompt guess guess)
            (unless guess
              (setq guess default-directory))
            (unless (ffap-file-remote-p guess)
              (setq guess (abbreviate-file-name (expand-file-name guess))))
            (read-file-name prompt
                            (file-name-directory guess) nil nil
                            (file-name-nondirectory guess))))
      ;; Remove the special handler manually.  We used to just let-bind
      ;; file-name-handler-alist to preserve its value, but that caused
      ;; other modifications to be lost (e.g. when Tramp gets loaded
      ;; during the completing-read call).
      (setq file-name-handler-alist (delq elem file-name-handler-alist)))))