Variable: whitespace-enable-predicate
whitespace-enable-predicate is a variable defined in whitespace.el.gz.
Value
#[0
"\302=\204$<\203 \242\303=\203\304A!?\202!\304!\202!\305\205A ?\205A\306 \307H\310=?\205A\306 \307H\311=?\206A\306 \312\230\207"
[whitespace-global-modes noninteractive t not derived-mode-p nil
buffer-name 0 32 42 "*scratch*"]
2]
Documentation
Predicate to decide which buffers obey global-whitespace-mode(var)/global-whitespace-mode(fun).
This function is called with no argument and should return non-nil
if the current buffer should obey global-whitespace-mode(var)/global-whitespace-mode(fun).
This variable is normally modified via add-function.
Probably introduced at or before Emacs version 28.1.
Source Code
;; Defined in /usr/src/emacs/lisp/whitespace.el.gz
(defvar whitespace-enable-predicate
(lambda ()
(and (cond
((eq whitespace-global-modes t))
((listp whitespace-global-modes)
(if (eq (car-safe whitespace-global-modes) 'not)
(not (derived-mode-p (cdr whitespace-global-modes)))
(derived-mode-p whitespace-global-modes)))
(t nil))
;; ...we have a display (not running a batch job)
(not noninteractive)
;; ...the buffer is not internal (name starts with a space)
(not (eq (aref (buffer-name) 0) ?\ ))
;; ...the buffer is not special (name starts with *)
(or (not (eq (aref (buffer-name) 0) ?*))
;; except the scratch buffer.
(string= (buffer-name) "*scratch*"))))
"Predicate to decide which buffers obey `global-whitespace-mode'.
This function is called with no argument and should return non-nil
if the current buffer should obey `global-whitespace-mode'.
This variable is normally modified via `add-function'.")