Function: hpath:handle-urls
hpath:handle-urls is a byte-compiled function defined in hpath.el.
Signature
(hpath:handle-urls)
Documentation
Partially configure file finding commands to recognize ftp and www URLs.
Recognizes full and abbreviated ftp and www URLs when a remote file access library is available.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hpath.el
(defun hpath:handle-urls ()
"Partially configure file finding commands to recognize ftp and www URLs.
Recognizes full and abbreviated ftp and www URLs when a remote file
access library is available."
(let ((remote-fs-package (hpath:remote-available-p)))
;; www-url functions are defined in "hsys-www.el".
(put 'expand-file-name remote-fs-package 'www-url-expand-file-name)
(put 'find-file-noselect remote-fs-package 'www-url-find-file-noselect)
;; Necessary since Dired overrides other file-name-handler-alist
;; settings.
(put 'expand-file-name 'dired 'www-url-expand-file-name)
(put 'find-file-noselect 'dired 'www-url-find-file-noselect)
(unless (fboundp 'hyperb:substitute-in-file-name)
(progn
;; Overload `substitute-in-file-name' to eliminate truncation of URL prefixes
;; such as http://.
(eval-and-compile
(unless (fboundp 'hyperb:substitute-in-file-name)
(defalias 'hyperb:substitute-in-file-name
(symbol-function 'substitute-in-file-name))))
(defun substitute-in-file-name (filename)
"Substitute environment variables referred to in FILENAME (skip Urls).
`$FOO' where FOO is an environment variable name means to substitute
the value of that variable. The variable name should be terminated
with a character not a letter, digit or underscore; otherwise, enclose
the entire variable name in braces.
If `/~' appears, all of FILENAME through that `/' is discarded."
(if (string-match
"\\(/\\|[^a-zA-Z0-9]\\)?\\(https?\\|s?ftp\\|telnet\\|news\\|nntp\\):[/~]"
filename)
(substring filename (match-beginning 2))
(hyperb:substitute-in-file-name filename)))))))