Variable: whitespace-enable-predicate

whitespace-enable-predicate is a variable defined in whitespace.el.gz.

Value

#[0 "\302=\204&�<\203\"�\242\303=\203�\304\305A\"?\202#�\304\305\"\202#�\306\205C�	?\205C�\307 \310H\311=?\205C�\307 \310H\312=?\206C�\307 \313\230\207"
    [whitespace-global-modes noninteractive t not apply derived-mode-p nil buffer-name 0 32 42 "*scratch*"]
    3]

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 (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)
         ;; ...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'.")