Make the default `whitespace-enable-predicate' use `derived-mode-p'
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 28 Jan 2021 07:40:15 +0000 (08:40 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 28 Jan 2021 07:40:15 +0000 (08:40 +0100)
* lisp/whitespace.el (whitespace-enable-predicate): Use
`derived-mode-p' to check modes instead of `eq' (bug#40481).

etc/NEWS
lisp/whitespace.el

index e038076e96c6f1a1331b27702071cc5ca4800130..f12c94d6491e94812b57ee22efcca4ee00c84e75 100644 (file)
--- 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
 
 ---
index 7b8e5b7cc11c6aad0383e4aa30d7c29abff11fcb..22bfae069750ead645c6415b3dd0a84311d22d99 100644 (file)
@@ -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)