7.6.2 Jumping to Holes

Use these commands to move between holes in the current Prolog buffer:

C-c TAB
C-c C-i

Move point to the next hole in the buffer and select it as the region. With numeric prefix argument n, move forward over n - 1 holes and select the next one (sweeprolog-forward-hole).

C-c S-TAB
C-c C-I

Move point to the previous hole in the buffer and select it as the region. With numeric prefix argument n, move backward over n - 1 holes and select the next one (sweeprolog-backward-hole).

C-0 C-c TAB
C-0 C-c C-i

Display the number of holes that are present in the buffer (sweeprolog-count-holes).

Command: sweeprolog-forward-hole-on-tab-mode

Toggle moving to the next hole in the buffer with TAB if the current line is already properly indented.

To jump to the next hole in a Sweep Prolog mode buffer, use the command sweeprolog-forward-hole, bound by default to C-c TAB (or C-c C-i). This command sets up the region to cover the next hole after point leaving the cursor at right after the hole. To jump to the previous hole use C-c S-TAB (sweeprolog-backward-hole), or call sweeprolog-forward-hole with a negative prefix argument (C-- C-c TAB).

You can also call sweeprolog-forward-hole and sweeprolog-backward-hole with a numeric prefix argument to jump over the specified number of holes. For example, typing C-3 C-c TAB skips the next two holes in the buffer and selects the third as the region. As a special case, if you call these commands with a zero prefix argument (C-0 C-c TAB), they invoke the command sweeprolog-count-holes instead of jumping. This command counts how many holes are left in the current buffer and reports its finding via a message in the echo area.

When the minor mode sweeprolog-forward-hole-on-tab-mode is enabled, the TAB key is bound to a command moves to the next hole when called in a properly indented line (otherwise it indents the line). This makes moving between holes in the buffer easier since you can use TAB instead of C-c TAB in most cases. To enable this mode in a, type M-x sweeprolog-forward-hole-on-tab-mode-map RET. You can automate this step by adding sweeprolog-forward-hole-on-tab-mode to sweeprolog-mode-hook in your Emacs configuration:

(add-hook 'sweeprolog-mode-hook #'sweeprolog-forward-hole-on-tab-mode)