Function: whitespace-mode

whitespace-mode is an autoloaded, interactive and byte-compiled function defined in whitespace.el.gz.

Signature

(whitespace-mode &optional ARG)

Documentation

Toggle whitespace visualization (Whitespace mode).

This is a minor mode. If called interactively, toggle the Whitespace mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate whitespace-mode(var)/whitespace-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

See also whitespace-style, whitespace-newline and whitespace-display-mappings.

This mode uses a number of faces to visualize the whitespace; see the customization group whitespace for details.

Probably introduced at or before Emacs version 23.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/whitespace.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; User commands - Local mode


;;;###autoload
(define-minor-mode whitespace-mode
  "Toggle whitespace visualization (Whitespace mode).

See also `whitespace-style', `whitespace-newline' and
`whitespace-display-mappings'.

This mode uses a number of faces to visualize the whitespace; see
the customization group `whitespace' for details."
  :lighter    " ws"
  :init-value nil
  :global     nil
  :group      'whitespace
  (cond
   (noninteractive			; running a batch job
    (setq whitespace-mode nil))
   (whitespace-mode			; whitespace-mode on
    (whitespace-turn-on)
    (whitespace-action-when-on))
   (t					; whitespace-mode off
    (whitespace-turn-off))))