Function: ghostel--drop-stranded-links
ghostel--drop-stranded-links is a natively compiled function defined
in ghostel-links.el.
Signature
(ghostel--drop-stranded-links BEGIN END MATCHED URLS FILES)
Documentation
Remove this scan's links in BEGIN..END that no match covers.
MATCHED is the list of (START . STOP) ranges the scan matched, whatever it then did with them. A row repainted on its own can leave the other rows of a wrapped link behind, pointing at text that is gone. URLS and FILES say which patterns ran: a link of a kind that was not scanned for is unexamined, not stranded.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-links.el
(defun ghostel--drop-stranded-links (begin end matched urls files)
"Remove this scan's links in BEGIN..END that no match covers.
MATCHED is the list of (START . STOP) ranges the scan matched, whatever
it then did with them. A row repainted on its own can leave the other
rows of a wrapped link behind, pointing at text that is gone.
URLS and FILES say which patterns ran: a link of a kind that was not
scanned for is unexamined, not stranded."
(let ((pos begin))
(while (setq pos (text-property-not-all pos end 'ghostel-link-id nil))
(let* ((stop (next-single-property-change pos 'ghostel-link-id nil end))
(echo (get-text-property pos 'help-echo))
(scanned (if (and (stringp echo)
(string-prefix-p "fileref:" echo))
files
urls)))
(when (and scanned
(ghostel--detected-link-p pos)
(not (ghostel--range-overlaps-p pos stop matched)))
(remove-text-properties pos stop
'(help-echo nil mouse-face nil keymap nil
ghostel-link-id nil
ghostel-link-text nil)))
(setq pos stop)))))