Function: hpath:remote-at-p
hpath:remote-at-p is a byte-compiled function defined in hpath.el.
Signature
(hpath:remote-at-p)
Documentation
Return a remote pathname that point is within or nil.
See the (Emacs)Remote Files info documentation for 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-at-p ()
"Return a remote pathname that point is within or nil.
See the `(Emacs)Remote Files' info documentation for pathname format details.
Always returns nil if (hpath:remote-available-p) returns nil."
(let ((remote-package (hpath:remote-available-p))
(user (hpath:remote-default-user))
path
path-no-site)
(when remote-package
(setq path
(save-excursion
(skip-chars-backward "^[ \t\n\r\f\"`'|\(\{<")
(cond
((and (eq remote-package 'tramp)
(looking-at (hpath:tramp-file-name-regexp)))
(match-string-no-properties 0))
((looking-at hpath:url-regexp)
(if (string-match-p "\\`s?ftp\\'" (match-string-no-properties hpath:protocol-grpn))
(concat
(format "/%s:" (match-string-no-properties hpath:protocol-grpn))
;; user
(if (match-beginning hpath:username-grpn)
(match-string-no-properties hpath:username-grpn)
(concat user "@"))
;; sitename
(hpath:delete-trailer
(match-string-no-properties hpath:sitename-grpn))
":"
;; path
(if (match-beginning hpath:pathname-grpn)
(match-string-no-properties hpath:pathname-grpn)))
;; else ignore this other type of WWW path
))
((or (looking-at hpath:url-regexp2)
(looking-at hpath:url-regexp3))
(if (string-match-p "\\`s?ftp\\'" (match-string-no-properties hpath:hostname-grpn))
(concat
(format "/%s:" (match-string-no-properties hpath:hostname-grpn))
user "@"
;; site
(hpath:delete-trailer
(match-string-no-properties hpath:sitename-grpn))
":"
;; path
(if (match-beginning hpath:pathname-grpn)
(match-string-no-properties hpath:pathname-grpn)))
;; else ignore this other type of WWW path
))
;; user, site and path
((looking-at "/?[^/:@ \t\n\r\"`'|]+@[^/:@ \t\n\r\"`'|]+:[^]@ \t\n\r\"`'|\)\}]+")
(match-string-no-properties 0))
;; @site and path
((looking-at "@[^/:@ \t\n\r\"`'|]+:[^]@:, \t\n\r\"`'|\)\}]+")
(concat "/" user (match-string-no-properties 0)))
;; site and path
((and (looking-at
"/?\\(\\([^/:@ \t\n\r\"`'|]+\\):\\([^]@:, \t\n\r\"`'|\)\}]+\\)\\)[] \t\n\r,.\"`'|\)\}]")
(setq path (match-string-no-properties 1) ;; includes site
path-no-site (match-string-no-properties 3))
(string-match "[^.]\\.[^.]" (match-string-no-properties 2))
(not (string-match "\\(\\`\\|:\\)[:0-9]+\\'" path-no-site))) ;; prevent matching to line:col suffixes
(concat "/" user "@" path))
;; host and path
((and (looking-at "/\\([^/:@ \t\n\r\"`'|]+:[^]@:, \t\n\r\"`'|\)\}]+\\)")
(setq path (match-string-no-properties 1)))
(concat "/" user "@" path)))))
(hpath:delete-trailer path))))