7.6.3 Filling Holes

Filling a hole means replacing it in the buffer with a Prolog term. The simplest way to fill a hole is how you would replace any other piece of text in Emacs—select it as the region, kill it (for example, with C-w) and insert another Prolog term in its place. For more information about the region, (emacs)Mark in the Emacs manual.

Yanking a hole with C-y (yank) after you kill it removes the special hole property and inserts it as a plain variable. This can be useful if you want to keep the variable name that Sweep chose for the hole—simply press C-w C-y with the hole marked. You can also use the command sweeprolog-fill-holes, which turns all holes in the current region to plain variables.

As an alternative to manually killing the region with C-w, if you enable Delete Selection mode (delete-selection-mode), the hole is automatically removed as soon as you start typing while its marked. See (emacs)Using Region, for more information about Delete Selection mode.

Most Sweep commands that insert holes also move to the first hole they insert and select it as the region for you to fill it. Similarly, jumping to the next hole in the buffer with C-c TAB also selects it. The command C-c RET is specifically designed for filling holes by deleting the selected hole and inserting a Prolog term at once (see Inserting Terms with Holes).