Function: refill-post-command-function
refill-post-command-function is a byte-compiled function defined in
refill.el.gz.
Signature
(refill-post-command-function)
Documentation
Post-command function to do refilling (conditionally).
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/refill.el.gz
(defun refill-post-command-function ()
"Post-command function to do refilling (conditionally)."
(when refill-doit ; there was a change
;; There's probably scope for more special cases here...
(pcase this-command
('self-insert-command
;; Treat self-insertion commands specially, since they don't
;; always reset `refill-doit' -- for self-insertion commands that
;; *don't* cause a refill, we want to leave it turned on so that
;; any subsequent non-modification command will cause a refill.
(when (aref auto-fill-chars (char-before))
;; Respond to the same characters as auto-fill (other than
;; newline, covered below).
(refill-fill-paragraph-at refill-doit)
(setq refill-doit nil)))
((or 'quoted-insert 'fill-paragraph 'fill-region) nil)
((or 'newline 'newline-and-indent 'open-line 'indent-new-comment-line
'default-indent-new-line 'reindent-then-newline-and-indent)
;; Don't zap what was just inserted.
(save-excursion
(beginning-of-line) ; for newline-and-indent
(skip-chars-backward "\n")
(save-restriction
(narrow-to-region (point-min) (point))
(refill-fill-paragraph-at refill-doit)))
(widen)
(save-excursion
(skip-chars-forward "\n")
(save-restriction
(narrow-to-region (line-beginning-position) (point-max))
(refill-fill-paragraph-at refill-doit))))
(_
(refill-fill-paragraph-at refill-doit)))
(setq refill-doit nil)))