[Top][All Lists]

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

master 8992f8a: Make the default `whitespace-enable-predicate' use `deri

From: Lars Ingebrigtsen
Subject: master 8992f8a: Make the default `whitespace-enable-predicate' use `derived-mode-p'
Date: Thu, 28 Jan 2021 02:40:25 -0500 (EST)

branch: master
commit 8992f8abf348b5b4eb2b2074d00b9c9aaaa6df17
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make the default `whitespace-enable-predicate' use `derived-mode-p'
    * lisp/whitespace.el (whitespace-enable-predicate): Use
    `derived-mode-p' to check modes instead of `eq' (bug#40481).
 etc/NEWS           | 5 +++++
 lisp/whitespace.el | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index e038076..f12c94d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1098,6 +1098,11 @@ If present in 'whitespace-style' (as it is by default), 
the final
 character in the buffer will be highlighted if the buffer doesn't end
 with a newline.
+*** The default 'whitespace-enable-predicate' predicate has changed.
+It used to check elements in the list version of
+'whitespace-global-modes' with 'eq', but now uses 'derived-mode-p'.
 ** Texinfo
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 7b8e5b7..22bfae0 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1000,8 +1000,8 @@ See also `whitespace-style', `whitespace-newline' and
           ((eq whitespace-global-modes t))
           ((listp whitespace-global-modes)
            (if (eq (car-safe whitespace-global-modes) 'not)
-               (not (memq major-mode (cdr whitespace-global-modes)))
-             (memq major-mode whitespace-global-modes)))
+               (not (apply #'derived-mode-p (cdr whitespace-global-modes)))
+             (apply #'derived-mode-p whitespace-global-modes)))
           (t nil))
          ;; ...we have a display (not running a batch job)
          (not noninteractive)

reply via email to

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