Function: word-wrap-whitespace-mode

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

Signature

(word-wrap-whitespace-mode &optional ARG)

Documentation

Allow word-wrap to fold on all breaking whitespace characters.

The characters to break on are defined by word-wrap-whitespace-characters.

This is a minor mode. If called interactively, toggle the Word-Wrap-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 the variable word-wrap-whitespace-mode(var)/word-wrap-whitespace-mode(fun).

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

View in manual

Probably introduced at or before Emacs version 29.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/word-wrap-mode.el.gz
;;;###autoload
(define-minor-mode word-wrap-whitespace-mode
  "Allow `word-wrap' to fold on all breaking whitespace characters.
The characters to break on are defined by `word-wrap-whitespace-characters'."
  :group 'display
  (if word-wrap-whitespace-mode
      (progn
        (setq-local word-wrap-mode--previous-state
                    (cons (category-table)
                          (buffer-local-set-state
                           word-wrap-by-category t
                           word-wrap t)))
        (set-category-table (copy-category-table))
        (dolist (char word-wrap-whitespace-characters)
          (modify-category-entry char ?|)))
    (set-category-table (car word-wrap-mode--previous-state))
    (buffer-local-restore-state (cdr word-wrap-mode--previous-state))))