Function: ghostel--find-link-1
ghostel--find-link-1 is a natively compiled function defined in
ghostel-links.el.
Signature
(ghostel--find-link-1 DIRECTION FROM)
Documentation
Return the start of the next/previous hyperlink from FROM, or nil.
DIRECTION is next or previous.
Treats runs sharing a ghostel-link-id as one logical link: if FROM is
inside such a run, other runs with that id are skipped; for previous,
the result is walked back to the earliest same-id run so a wrapped URL
lands at its start, not its last chunk.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-links.el
(defun ghostel--find-link-1 (direction from)
"Return the start of the next/previous hyperlink from FROM, or nil.
DIRECTION is `next' or `previous'.
Treats runs sharing a `ghostel-link-id' as one logical link: if FROM is
inside such a run, other runs with that id are skipped; for `previous',
the result is walked back to the earliest same-id run so a wrapped URL
lands at its start, not its last chunk."
(let ((search-fn (if (eq direction 'next)
#'text-property-search-forward
#'text-property-search-backward))
(skip-id (get-text-property from 'ghostel-link-id)))
(save-excursion
(goto-char from)
(catch 'found
(while-let ((match (funcall search-fn 'help-echo nil
(lambda (_ v) v) t)))
(let* ((pos (prop-match-beginning match))
(id (get-text-property pos 'ghostel-link-id)))
(unless (and skip-id (equal skip-id id))
(when (and (eq direction 'previous) id)
(catch 'walked
(while-let ((earlier (text-property-search-backward
'help-echo nil
(lambda (_ v) v) t)))
(let ((earlier-pos (prop-match-beginning earlier)))
(if (equal id (get-text-property
earlier-pos 'ghostel-link-id))
(setq pos earlier-pos)
(throw 'walked nil))))))
(throw 'found pos))))))))