Function: browse-url-file-url

browse-url-file-url is a byte-compiled function defined in browse-url.el.gz.

Signature

(browse-url-file-url FILE)

Documentation

Return the URL corresponding to FILE.

Use variable browse-url-filename-alist to map filenames to URLs.

Source Code

;; Defined in /usr/src/emacs/lisp/net/browse-url.el.gz
(defun browse-url-file-url (file)
  "Return the URL corresponding to FILE.
Use variable `browse-url-filename-alist' to map filenames to URLs."
  (let ((coding (if (equal system-type 'windows-nt)
		    ;; W32 pretends that file names are UTF-8 encoded.
		    'utf-8
		  (and (or file-name-coding-system
			   default-file-name-coding-system)))))
    (if coding (setq file (encode-coding-string file coding))))
  (setq file (browse-url-url-encode-chars file "[*\"()',=;?% ]"))
  (dolist (map browse-url-filename-alist)
    (when (and map (string-match (car map) file))
      (setq file (replace-match (cdr map) t nil file))))
  file)