From 4085a2c15e4f9e162bf8c9b77f4a1a2a84ad9437 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 8 Aug 2020 11:53:09 +0200 Subject: [PATCH] Tweak how whitespace-mode marks the end of the buffer * lisp/whitespace.el (whitespace-missing-newline-at-eof): Change the colours to not be as angry. (whitespace-color-on): Don't mark the end of the buffer if point is there. --- lisp/whitespace.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/whitespace.el b/lisp/whitespace.el index fb5f28c0029..42c4b61daff 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -594,7 +594,7 @@ line. Used when `whitespace-style' includes the value `indentation'.") (defface whitespace-missing-newline-at-eof '((((class mono)) :inverse-video t :weight bold :underline t) - (t :background "red" :foreground "firebrick")) + (t :background "#d0d040" :foreground "black")) "Face used to visualize missing newline at the end of the file.") (defvar whitespace-empty 'whitespace-empty @@ -2137,7 +2137,13 @@ resultant list will be returned." 1 whitespace-space-after-tab t))) ,@(when (memq 'missing-newline-at-eof whitespace-active-style) ;; Show missing newline. - `(("[^\n]\\'" 0 'whitespace-missing-newline-at-eof t))))) + `(("[^\n]\\'" 0 + ;; Don't mark the end of the buffer is point is there -- + ;; it probably means that the user is typing something + ;; at the end of the buffer. + (and (/= whitespace-point (point-max)) + 'whitespace-missing-newline-at-eof) + t))))) (font-lock-add-keywords nil whitespace-font-lock-keywords t) (font-lock-flush))) -- 2.39.2