From 8992f8abf348b5b4eb2b2074d00b9c9aaaa6df17 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 28 Jan 2021 08:40:15 +0100 Subject: [PATCH] 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 e038076e96c..f12c94d6491 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 7b8e5b7cc11..22bfae06975 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) -- 2.39.5