Function: evil-bounds-of-not-thing-at-point

evil-bounds-of-not-thing-at-point is a byte-compiled function defined in evil-common.el.

Signature

(evil-bounds-of-not-thing-at-point THING &optional WHICH)

Documentation

Return the bounds of a complement of THING at point.

If there is a THING at point nil is returned. Otherwise if WHICH is nil or 0 a cons cell (BEG . END) is returned. If WHICH is negative the beginning is returned. If WHICH is positive the END is returned.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-bounds-of-not-thing-at-point (thing &optional which)
  "Return the bounds of a complement of THING at point.
If there is a THING at point nil is returned.  Otherwise if WHICH
is nil or 0 a cons cell (BEG . END) is returned. If WHICH is
negative the beginning is returned. If WHICH is positive the END
is returned."
  (let ((pnt (point)))
    (let ((beg (save-excursion
                 (and (zerop (forward-thing thing -1))
                      (forward-thing thing))
                 (if (> (point) pnt) (point-min) (point))))
          (end (save-excursion
                 (and (zerop (forward-thing thing))
                      (forward-thing thing -1))
                 (if (< (point) pnt) (point-max) (point)))))
      (when (and (<= beg (point) end) (< beg end))
        (cond
         ((or (not which) (zerop which)) (cons beg end))
         ((< which 0) beg)
         ((> which 0) end))))))