Function: whitespace-empty-at-bob-regexp
whitespace-empty-at-bob-regexp is a byte-compiled function defined in
whitespace.el.gz.
Signature
(whitespace-empty-at-bob-regexp LIMIT)
Documentation
Match spaces at beginning of buffer (BOB) which do not contain point at BOB.
Source Code
;; Defined in /usr/src/emacs/lisp/whitespace.el.gz
(defun whitespace-empty-at-bob-regexp (limit)
"Match spaces at beginning of buffer (BOB) which do not contain point at BOB."
(let ((b (point))
r)
(cond
;; at bob
((= b 1)
(setq r (and (looking-at whitespace-empty-at-bob-regexp)
(or (/= whitespace-point 1)
(progn (whitespace-point--used (match-beginning 0)
(match-end 0))
nil))))
(set-marker whitespace-bob-marker (if r (match-end 1) b)))
;; inside bob empty region
((<= limit whitespace-bob-marker)
(setq r (looking-at whitespace-empty-at-bob-regexp))
(if r
(when (< (match-end 1) limit)
(set-marker whitespace-bob-marker (match-end 1)))
(set-marker whitespace-bob-marker b)))
;; intersection with end of bob empty region
((<= b whitespace-bob-marker)
(setq r (looking-at whitespace-empty-at-bob-regexp))
(set-marker whitespace-bob-marker (if r (match-end 1) b)))
;; it is not inside bob empty region
(t
(setq r nil)))
;; move to end of matching
(and r (goto-char (match-end 1)))
r))