Function: whitespace--empty-at-eob-matcher

whitespace--empty-at-eob-matcher is a byte-compiled function defined in whitespace.el.gz.

Signature

(whitespace--empty-at-eob-matcher LIMIT)

Documentation

Match empty/space-only lines at end of buffer (EoB).

Match does not extend past position LIMIT. For improved UX, the line containing whitespace-point and preceding 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 previous empty lines will no longer be EoB empty lines. Highlighting those lines can be distracting.)

Source Code

;; Defined in /usr/src/emacs/lisp/whitespace.el.gz
(defun whitespace--empty-at-eob-matcher (limit)
  "Match empty/space-only lines at end of buffer (EoB).
Match does not extend past position LIMIT.  For improved UX, the
line containing `whitespace-point' and preceding 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 previous
empty lines will no longer be EoB empty lines.  Highlighting
those lines can be distracting.)"
  (when (= limit (1+ (buffer-size)))
    (with-silent-modifications
      ;; See the comment in `whitespace--update-bob-eob' for why this
      ;; text property is added here.
      (put-text-property whitespace-eob-marker limit
                         'font-lock-multiline t)))
  (let ((b (max (point) whitespace-eob-marker
                whitespace-bob-marker ; See comment in the bob func.
                (save-excursion (goto-char whitespace-point)
                                (forward-line 1)
                                (point)))))
    (when (< b limit)
      (set-match-data (list b limit))
      (goto-char limit))))