Function: expreg--valid-p

expreg--valid-p is a natively compiled function defined in expreg.el.

Signature

(expreg--valid-p REGION ORIG)

Documentation

Return non-nil if REGION = (BEG . END) valid regarding ORIG.

ORIG is the current position.

Source Code

;; Defined in /nix/store/29cdhkmkqv2bgp3p30khhf35kkbgx1ya-emacs-packages-deps/share/emacs/site-lisp/elpa/expreg-1.4.1/expreg.el
(defun expreg--valid-p (region orig)
  "Return non-nil if REGION = (BEG . END) valid regarding ORIG.
ORIG is the current position."
  (let ((producer (car region))
        (beg (cadr region))
        (end (cddr region)))

    (or (memq producer expreg--validation-white-list)
        (and (<= beg orig end)
             (< beg end)
             ;; We don’t filter out regions that’s only one character
             ;; long, because there are useful regions of that size.
             ;; Consider ‘c-ts-mode--looking-at-star’, the "c" is one
             ;; character long but we don’t want to skip it: my muscle
             ;; remembers to hit C-= twice to mark a symbol, skipping "c"
             ;; messes that up. (ref:single-char-region)
             ;; (< 1 (- end beg) 8000)

             ;; If the region is only one character long, and the
             ;; character is stuff like bracket, escape char, quote, etc,
             ;; filter it out. This is usually returned by
             ;; ‘expreg--treesit’.
             (not (and (eq (- end beg) 1)
                       (not (memq (char-syntax (char-after beg))
                                  '(?- ?w ?_)))))))))