7.2.2 Highlighting occurrences of a variable

Sweep Prolog mode can highlight all occurrences of a given Prolog variable in the clause in which it appears. By default, occurrences of the variable at point are highlighted automatically whenever you move the cursor into a variable. To achieve this, Sweep uses the Emacs minor mode cursor-sensor-mode which allows for running hooks when the cursor enters or leaves certain text regions (see Special Properties in the Elisp manual).

Command: sweeprolog-highlight-variable

Highlight occurrences of a Prolog variable in the clause at point. With a prefix argument, clear variable highlighting in the clause at point instead.

User Option: sweeprolog-enable-cursor-sensor

Whether to use cursor-sensor-mode to highlight occurrences of the Prolog variable across the current clause. Defaults to t.

To disable automatic variable highlighting based on the variable at point, customize sweeprolog-enable-cursor-sensor to nil.

To manually highlight occurrences of a variable in the current clause, use the command M-x sweeprolog-highlight-variable. This command prompts for variable to highlight, defaulting to the variable at point, if any. If you call it with a prefix argument (C-u M-x sweeprolog-highlight-variable RET), it clears all variable highlighting in the current clause instead.