Emacs includes many useful features for operating on syntactic units in source code buffer, such as marking, transposing and moving over expressions. By default, these features are geared towards working with Lisp expressions, or S-expressions. Sweep extends Emacs’s notion of syntactic expressions to accommodate for Prolog terms, which allows the standard S-expression based commands to operate on Prolog terms seamlessly.
The Emacs manual covers the most important commands that operate on S-expressions, and by extension on Prolog terms. See (emacs)Expressions. Another useful command for Prolog programmers is M-x kill-backward-up-list, bound by default to C-M-^ in Sweep Prolog mode buffers.
Kill the Prolog term containing the current term, leaving the current
term itself (
This command replaces the parent term containing the term at point with the term itself. To illustrate the utility of this command, consider the following clause:
head :- goal1, setup_call_cleanup(setup, goal2, cleanup).
Now with point anywhere inside
kill-backward-up-list removes the
goal2 to be called directly:
head :- goal1, goal2.