Variable: refill-ignorable-overlay

refill-ignorable-overlay is a buffer-local variable defined in refill.el.gz.

Documentation

Portion of the most recently filled paragraph not needing filling.

This is used to optimize refilling.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/refill.el.gz
;;; refill.el --- `auto-fill' by refilling paragraphs on changes  -*- lexical-binding: t -*-

;; Copyright (C) 2000-2026 Free Software Foundation, Inc.

;; Author: Dave Love <fx@gnu.org>
;; Maintainer: Miles Bader <miles@gnu.org>
;; Keywords: text

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; Provides a mode where paragraphs are refilled after changes in them
;; (using `after-change-functions').  This gives something akin to typical
;; word processor-style filling.  We restrict refilling due to
;; self-insertion to the characters which trigger auto-fill.

;; It partly satisfies a todo item in enriched.el for some value of
;; `without slowing down editing too much'.  It doesn't attempt to do
;; anything (using `window-size-change-functions'?) about resizing
;; windows -- who cares?

;; This implementation is probably fragile and missing some special
;; cases -- not extensively tested.  Yanking paragraph breaks, for
;; instance, won't DTRT by refilling all the relevant paragraphs.

;; You could do it a bit more efficiently (and robustly?) with just an
;; auto-fill function, but that doesn't cope with changes other than
;; through self-insertion.  (Using auto-fill and after-change
;; functions together didn't seem winning.)  This could probably
;; benefit from a less-general and faster `fill-paragraph-function',
;; ideally as a primitive.

;; The work is done in a local post-command hook but only if
;; `refill-doit' has been set by the after-change function.  Using
;; `post-command-hook' ensures simply that refilling only happens
;; once per command.

;; [Per Abrahamsen's maniac.el does a similar thing, but operates from
;; post-command-hook.  I don't understand the statement in it that
;; after-change-functions don't work for this purpose; perhaps there was
;; some Emacs bug at the time.  ISTR maniac has problems with
;; whitespace at the end of paragraphs.]

;;; Todo/Bugs:

;; - When deleting the first word on a line, the space after that word tends
;;   to become part of the fill-prefix, causing either wrong filling of the
;;   remaining text, or causing the cursor to move unexpectedly.  Ex:
;;   Start with
;;                I>< blabla
;;
;;   and hit backspace.  We end up with
;;
;;                 ><blabla
;;   instead of
;;                >< blabla
;;
;;   Other example.  Start with
;;
;;     Foo bar blablabla asdgf
;;     word>< asdfas dfasdfasd
;;     asd asdfa sdfasd sdf
;;
;;   and hit M-backspace.  We end up with
;;
;;     Foo bar blablabla asdgf
;;      ><asdfas dfasdfasd asd
;;      asdfa sdfasd sdf

;;; Code:

(defvar-local refill-ignorable-overlay nil
  "Portion of the most recently filled paragraph not needing filling.
This is used to optimize refilling.")