Function: ghostel--link-bounds
ghostel--link-bounds is a natively compiled function defined in
ghostel-links.el.
Signature
(ghostel--link-bounds POS)
Documentation
Return (BEG . END) covering every fragment of the link at POS, or nil.
Fragments of a soft-wrapped link share a ghostel-link-id but never
cover the wrap newline between them, so the span is extended across
single newlines whose neighbor continues the same link.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-links.el
(defun ghostel--link-bounds (pos)
"Return (BEG . END) covering every fragment of the link at POS, or nil.
Fragments of a soft-wrapped link share a `ghostel-link-id' but never
cover the wrap newline between them, so the span is extended across
single newlines whose neighbor continues the same link."
(let* ((echo (get-text-property pos 'help-echo))
(id (get-text-property pos 'ghostel-link-id))
(same (lambda (p)
(and (equal echo (get-text-property p 'help-echo))
(equal id (get-text-property p 'ghostel-link-id)))))
(beg pos)
(end pos))
(when (stringp echo)
(while (cond ((and (> beg (point-min)) (funcall same (1- beg)))
(setq beg (1- beg)))
((and id (> beg (1+ (point-min)))
(get-text-property (1- beg) 'ghostel-wrap)
(funcall same (- beg 2)))
(setq beg (- beg 2)))))
(while (cond ((and (< end (point-max)) (funcall same end))
(setq end (1+ end)))
((and id (< (1+ end) (point-max))
(get-text-property end 'ghostel-wrap)
(funcall same (1+ end)))
(setq end (1+ end)))))
(cons beg end))))