Function: toggle-text-mode-auto-fill

toggle-text-mode-auto-fill is an interactive and byte-compiled function defined in text-mode.el.gz.

Signature

(toggle-text-mode-auto-fill)

Documentation

Toggle whether to use Auto Fill in Text mode and related modes.

This command affects all buffers that use modes related to Text mode, both existing buffers and buffers that you subsequently create.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/text-mode.el.gz
(defun toggle-text-mode-auto-fill ()
  "Toggle whether to use Auto Fill in Text mode and related modes.
This command affects all buffers that use modes related to Text mode,
both existing buffers and buffers that you subsequently create."
  (interactive)
  (let ((enable-mode (not (memq 'turn-on-auto-fill text-mode-hook))))
    (if enable-mode
        (add-hook 'text-mode-hook #'turn-on-auto-fill)
      (remove-hook 'text-mode-hook #'turn-on-auto-fill))
    (dolist (buffer (buffer-list))
      (with-current-buffer buffer
	(if (or (derived-mode-p 'text-mode) text-mode-variant)
	    (auto-fill-mode (if enable-mode 1 0)))))
    (message "Auto Fill %s in Text modes"
	     (if enable-mode "enabled" "disabled"))))