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).
This commit is contained in:
Lars Ingebrigtsen 2021-01-28 08:40:15 +01:00
parent e7e7ef1588
commit 8992f8abf3
2 changed files with 7 additions and 2 deletions

View file

@ -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
---

View 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)