Function: hpath:remote-p
hpath:remote-p is a byte-compiled function defined in hpath.el.
Signature
(hpath:remote-p PATH)
Documentation
Return a normalized form of PATH if a remote, non-local, pathname, else nil.
See the (Tramp)Top Emacs Lisp package manual for remote
pathname format details. Always returns nil
if (hpath:remote-available-p) returns nil.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hpath.el
(defun hpath:remote-p (path)
"Return a normalized form of PATH if a remote, non-local, pathname, else nil.
See the `(Tramp)Top' Emacs Lisp package manual for remote
pathname format details. Always returns nil
if (hpath:remote-available-p) returns nil."
(and (stringp path)
(let ((remote-package (hpath:remote-available-p))
(user (hpath:remote-default-user))
result)
(setq result
(cond
((null remote-package) nil)
((eq remote-package 'tramp)
(if (tramp-tramp-file-p path) path))
((string-match hpath:string-url-regexp path)
(if (string-match-p "\\`s?ftp\\'" (match-string-no-properties hpath:protocol-grpn path))
(concat
"/"
;; user
(if (match-beginning hpath:username-grpn)
(match-string-no-properties hpath:username-grpn path)
(concat user "@"))
;; site
(hpath:delete-trailer
(match-string-no-properties hpath:sitename-grpn path))
":"
;; path
(if (match-beginning hpath:pathname-grpn)
(match-string-no-properties hpath:pathname-grpn path)))
;; else ignore this other type of WWW path
))
((or (string-match hpath:string-url-regexp2 path)
(string-match hpath:string-url-regexp3 path))
(if (string-match-p "\\`s?ftp\\'"
(match-string-no-properties hpath:hostname-grpn path))
(concat
"/" user "@"
;; site
(hpath:delete-trailer
(match-string-no-properties hpath:sitename-grpn path))
":"
;; path
(if (match-beginning hpath:pathname-grpn)
(match-string-no-properties hpath:pathname-grpn path)))
;; else ignore this other type of WWW path
))
;; user, site and path
((string-match "/?[^/:@ \t\n\r\"`'|]+@[^/:@ \t\n\r\"`'|]+:[^]@ \t\n\r\"`'|\)\}]*"
path)
(match-string-no-properties 0 path))
;; @site and path
((string-match "@[^/:@ \t\n\r\"`'|]+:[^]@ \t\n\r\"`'|\)\}]*"
path)
(concat "/" user (match-string-no-properties 0 path)))
;; site and path
((and (string-match
"/?\\(\\([^/:@ \t\n\r\"`'|]+\\):[^]@:, \t\n\r\"`'|\)\}]*\\)"
path)
(setq result (match-string-no-properties 1 path))
(string-match "[^.]\\.[^.]"
(match-string-no-properties 2 path)))
(concat "/" user "@" result))
;; host and path
((and (string-match
"/\\([^/:@ \t\n\r\"`'|]+:[^]@:, \t\n\r\"`'|\)\}]*\\)"
path)
(setq result (match-string-no-properties 1 path)))
(concat "/" user "@" result))))
(hpath:delete-trailer result))))