]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix font-lock of last character before EOB under 'whitespace-mode'
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 19 Sep 2024 15:50:26 +0000 (11:50 -0400)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Sep 2024 10:45:25 +0000 (12:45 +0200)
* lisp/whitespace.el (whitespace-color-on): Don't use OVERRIDE in
font-lock-keywords; instead, use 'prepend' in the call to
'font-lock-add-keywords'.  (Bug#73332)

(cherry picked from commit 35e356f958af69baad8a1a824c59993915fb6abe)

lisp/whitespace.el

index d1b1f84f9232d934d70d33ab32ad67a751ef012d..cd8cd0450f2d0d7310d16fe122f59384ced5bd88 100644 (file)
@@ -739,7 +739,7 @@ This variable is used when `whitespace-style' includes
 
 (defcustom whitespace-indentation-regexp
   '("^\t*\\(\\( \\{%d\\}\\)+\\)[^\n\t]"
-    . "^ *\\(\t+\\)[^\n]")
+    . "^ *\\(\t+\\).")
   "Regexps to match indentation whitespace that should be visualized.
 
 The value should be a cons whose car specifies the regexp to match
@@ -1752,7 +1752,7 @@ cleaning up these problems."
                        ((eq (car option) 'space-after-tab::space)
                         (whitespace-space-after-tab-regexp 'space))
                        ((eq (car option) 'missing-newline-at-eof)
-                        "[^\n]\\'")
+                        ".\\'")
                        (t
                         (cdr option)))))
                  (when (re-search-forward regexp rend t)
@@ -2188,14 +2188,14 @@ 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
-              ;; Don't mark the end of the buffer is point is there --
+           `((".\\'" 0
+              ;; Don't mark the end of the buffer if 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)
+              prepend)))))
+    (font-lock-add-keywords nil whitespace-font-lock-keywords 'append)
     (font-lock-flush)))