Function: whitespace-empty-at-eob-regexp
whitespace-empty-at-eob-regexp is a byte-compiled function defined in
whitespace.el.gz.
Signature
(whitespace-empty-at-eob-regexp LIMIT)
Documentation
Match spaces at end of buffer which do not contain the point at end of buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/whitespace.el.gz
(defun whitespace-empty-at-eob-regexp (limit)
"Match spaces at end of buffer which do not contain the point at end of \
buffer."
(let ((b (point))
(e (1+ (buffer-size)))
r)
(cond
;; at eob
((= limit e)
(goto-char limit)
(setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b))
(when (and r (= whitespace-point e))
(setq r nil)
(whitespace-point--used (match-beginning 0) (match-end 0)))
(if r
(set-marker whitespace-eob-marker (match-beginning 1))
(set-marker whitespace-eob-marker limit)
(goto-char b))) ; return back to initial position
;; inside eob empty region
((>= b whitespace-eob-marker)
(goto-char limit)
(setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b))
(if r
(when (> (match-beginning 1) b)
(set-marker whitespace-eob-marker (match-beginning 1)))
(set-marker whitespace-eob-marker limit)
(goto-char b))) ; return back to initial position
;; intersection with beginning of eob empty region
((>= limit whitespace-eob-marker)
(goto-char limit)
(setq r (whitespace-looking-back whitespace-empty-at-eob-regexp b))
(if r
(set-marker whitespace-eob-marker (match-beginning 1))
(set-marker whitespace-eob-marker limit)
(goto-char b))) ; return back to initial position
;; it is not inside eob empty region
(t
(setq r nil)))
r))