Function: ghostel--joined-token-at-point

ghostel--joined-token-at-point is a natively compiled function defined in ghostel-links.el.

Signature

(ghostel--joined-token-at-point CHARS)

Documentation

Return the run of CHARS around point on the joined logical line, or nil.

CHARS is a skip-chars style set. Nil when point's line has no soft wrap or no such run touches point.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-links.el
(defun ghostel--joined-token-at-point (chars)
  "Return the run of CHARS around point on the joined logical line, or nil.
CHARS is a `skip-chars' style set.  Nil when point's line has no soft
wrap or no such run touches point."
  (when-let* ((joined (ghostel--logical-line-at-point)))
    (let* ((text (car joined))
           (class (concat "[" chars "]"))
           (len (length text))
           (start (min (ghostel--wrap-pos-to-offset (point) (cdr joined)) len))
           (end start))
      (while (and (> start 0)
                  (string-match-p class (char-to-string (aref text (1- start)))))
        (setq start (1- start)))
      (while (and (< end len)
                  (string-match-p class (char-to-string (aref text end))))
        (setq end (1+ end)))
      (and (< start end) (substring text start end)))))