Function: refill-mode
refill-mode is an autoloaded, interactive and byte-compiled function
defined in refill.el.gz.
Signature
(refill-mode &optional ARG)
Documentation
Toggle automatic refilling (Refill mode).
Refill mode is a buffer-local minor mode. When enabled, the current paragraph is refilled as you edit. Self-inserting characters only cause refilling if they would cause auto-filling.
For true "word wrap" behavior, use visual-line-mode(var)/visual-line-mode(fun) instead.
This is a minor mode. If called interactively, toggle the Refill 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 refill-mode(var)/refill-mode(fun).
The mode's hook is called both when the mode is enabled and when it is disabled.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/refill.el.gz
;;;###autoload
(define-minor-mode refill-mode
"Toggle automatic refilling (Refill mode).
Refill mode is a buffer-local minor mode. When enabled, the
current paragraph is refilled as you edit. Self-inserting
characters only cause refilling if they would cause
auto-filling.
For true \"word wrap\" behavior, use `visual-line-mode' instead."
;; Not global, so no effect.
;;; :group 'refill
:lighter " Refill"
:keymap '(("\177" . backward-delete-char-untabify))
;; Remove old state if necessary
(when refill-ignorable-overlay
(delete-overlay refill-ignorable-overlay)
(kill-local-variable 'refill-ignorable-overlay))
(when (local-variable-p 'refill-saved-state)
(dolist (x refill-saved-state)
(set (make-local-variable (car x)) (cdr x)))
(kill-local-variable 'refill-saved-state))
(if refill-mode
(progn
(add-hook 'after-change-functions #'refill-after-change-function nil t)
(add-hook 'post-command-hook #'refill-post-command-function nil t)
(add-hook 'pre-command-hook #'refill-pre-command-function nil t)
(setq-local refill-saved-state
(mapcar (lambda (s) (cons s (symbol-value s)))
'(fill-paragraph-function auto-fill-function)))
;; This provides the test for recursive paragraph filling.
(setq-local fill-paragraph-function #'refill-fill-paragraph)
;; When using justification, doing DEL on 2 spaces should remove
;; both, otherwise, the subsequent refill will undo the DEL.
(setq-local backward-delete-char-untabify-method 'hungry)
(setq refill-ignorable-overlay (make-overlay 1 1 nil nil t))
(overlay-put refill-ignorable-overlay 'modification-hooks
'(refill-adjust-ignorable-overlay))
(overlay-put refill-ignorable-overlay 'insert-behind-hooks
'(refill-adjust-ignorable-overlay))
(auto-fill-mode -1))
(remove-hook 'after-change-functions #'refill-after-change-function t)
(remove-hook 'post-command-hook #'refill-post-command-function t)
(kill-local-variable 'backward-delete-char-untabify-method)))