Function: whitespace--empty-at-bob-matcher
whitespace--empty-at-bob-matcher is a byte-compiled function defined
in whitespace.el.gz.
Signature
(whitespace--empty-at-bob-matcher LIMIT)
Documentation
Match empty/space-only lines at beginning of buffer (BoB).
Match does not extend past position LIMIT. For improved UX, the
line containing whitespace-point and subsequent lines are
excluded from the match. (The idea is that the user might be
about to start typing, and if they do, that line and any
following empty lines will no longer be BoB empty lines.
Highlighting those lines can be distracting.)
Source Code
;; Defined in /usr/src/emacs/lisp/whitespace.el.gz
(defun whitespace--empty-at-bob-matcher (limit)
"Match empty/space-only lines at beginning of buffer (BoB).
Match does not extend past position LIMIT. For improved UX, the
line containing `whitespace-point' and subsequent lines are
excluded from the match. (The idea is that the user might be
about to start typing, and if they do, that line and any
following empty lines will no longer be BoB empty lines.
Highlighting those lines can be distracting.)"
(let ((p (point))
(e (min whitespace-bob-marker limit
;; EoB marker will be before BoB marker if the buffer
;; has nothing but empty lines.
whitespace-eob-marker
(save-excursion (goto-char whitespace-point)
(line-beginning-position)))))
(when (= p 1)
(with-silent-modifications
;; See the comment in `whitespace--update-bob-eob' for why
;; this text property is added here.
(put-text-property 1 whitespace-bob-marker
'font-lock-multiline t)))
(when (< p e)
(set-match-data (list p e))
(goto-char e))))