Function: syntax--lbp

syntax--lbp is a byte-compiled function defined in syntax.el.gz.

Signature

(syntax--lbp &optional ARG)

Documentation

Like line-beginning-position but obeying syntax-wholeline-max.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/syntax.el.gz
(defun syntax--lbp (&optional arg)
  "Like `line-beginning-position' but obeying `syntax-wholeline-max'."
  (let ((pos (point))
        (res (line-beginning-position arg)))
    (cond
     ((< (abs (- pos res)) syntax-wholeline-max) res)
     ;; For lines that are too long, round to the nearest multiple of
     ;; `syntax-wholeline-max'.  We use rounding rather than just
     ;; (min res (+ pos syntax-wholeline-max)) so that repeated calls
     ;; to `syntax-propertize-wholelines' don't keep growing the bounds,
     ;; i.e. it really behaves like additional line-breaks.
     ((< res pos)
      (let ((max syntax-wholeline-max))
        (max (point-min) (* max (truncate pos max)))))
     (t
      (let ((max syntax-wholeline-max))
        (min (point-max) (* max (ceiling pos max))))))))