emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4085a2c: Tweak how whitespace-mode marks the end of the buffer


From: Lars Ingebrigtsen
Subject: master 4085a2c: Tweak how whitespace-mode marks the end of the buffer
Date: Sat, 8 Aug 2020 05:53:19 -0400 (EDT)

branch: master
commit 4085a2c15e4f9e162bf8c9b77f4a1a2a84ad9437
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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 fb5f28c..42c4b61 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)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]