Function: ghostel--run-queued-plain-link-detection

ghostel--run-queued-plain-link-detection is a natively compiled function defined in ghostel-links.el.

Signature

(ghostel--run-queued-plain-link-detection BUFFER)

Documentation

Scan one chunk of BUFFER's queued plain-text link detection range.

Takes ghostel--link-detection-chunk characters off the newest end of the range, so what is on screen is linkified first and a backlog is caught up on afterwards, then re-arms while anything is left.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-links.el
(defun ghostel--run-queued-plain-link-detection (buffer)
  "Scan one chunk of BUFFER's queued plain-text link detection range.
Takes `ghostel--link-detection-chunk' characters off the newest end of
the range, so what is on screen is linkified first and a backlog is
caught up on afterwards, then re-arms while anything is left."
  (when (buffer-live-p buffer)
    (with-current-buffer buffer
      (setq ghostel--plain-link-detection-timer nil)
      (let ((begin ghostel--plain-link-detection-begin)
            (end ghostel--plain-link-detection-end))
        (when (and begin end (<= (marker-position begin) (marker-position end)))
          (let* ((stop (marker-position end))
                 (start (max (marker-position begin)
                             (- stop ghostel--link-detection-chunk)))
                 ;; The scan widens to whole logical lines; resume from where
                 ;; it really started rather than rescanning that line.
                 (next (car (ghostel--detect-urls start stop))))
            (if (<= next (marker-position begin))
                (ghostel--clear-plain-link-detection-bounds)
              (set-marker end next)
              (setq ghostel--plain-link-detection-timer
                    (run-with-timer ghostel-plain-link-detection-delay nil
                                    #'ghostel--run-queued-plain-link-detection
                                    buffer)))))))))