Variable: whitespace-enable-predicate

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

Value

#[0
  "\303=\204$�<\203 �\242\304=\203�\305A!?\202!�\305!\202!�\306\205W�	?\205W�\307 \310H\311=?\205W�\307 \310H\312=?\206W�\n\211\203W�\211@\211\307 \306\313\303$\266\204\204W�A\202>�\207"
  [whitespace-global-modes noninteractive
			   whitespace-global-mode-buffers t not
			   derived-mode-p nil buffer-name 0 32 42
			   string-match]
  10]

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) ?\s))
         ;; ...the buffer is not special (name starts with *)
         (or (not (eq (aref (buffer-name) 0) ?*))
             ;; except, e.g., the scratch buffer.
             (any (lambda (re)
                    (string-match-p re (buffer-name)))
                  whitespace-global-mode-buffers))))
  "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'.")