Function: ghostel--thing-at-point-url
ghostel--thing-at-point-url is a natively compiled function defined in
ghostel-links.el.
Signature
(ghostel--thing-at-point-url)
Documentation
Return the URL at point, crossing soft-wrapped rows.
For thing-at-point-provider-alist. On a URL link (OSC 8 or
detected) this is the link target; elsewhere on a wrapped line, the
URL match around point.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-links.el
(defun ghostel--thing-at-point-url ()
"Return the URL at point, crossing soft-wrapped rows.
For `thing-at-point-provider-alist'. On a URL link (OSC 8 or
detected) this is the link target; elsewhere on a wrapped line, the
URL match around point."
(let ((uri (ghostel--link-uri-at-point)))
(cond
((and uri (not (string-prefix-p "fileref:" uri))) uri)
(uri nil) ; file link: not a URL
(t (when-let* ((joined (ghostel--logical-line-at-point)))
(let* ((text (car joined))
(off (ghostel--wrap-pos-to-offset (point) (cdr joined)))
(start 0)
(found nil))
(while (and (not found)
(string-match ghostel--url-regex text start)
(<= (match-beginning 0) off))
(if (<= off (match-end 0))
(setq found (match-string 0 text))
(setq start (match-end 0))))
found))))))