Subject: bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct

From: Markus Triska <[email-masked]>
Date: Wed, 30 Sep 2015 20:11:41 +0200

Stefan Monnier <[email-masked]> writes:

> It does, if you do the C-M-f from just before the dot.
> The fact that you have to "jump over the dot" is the crucial hint you
> (the user) give to Emacs that you want to jump over "the whole LHS/RHS
> of that dot" rather than over a deeper part of the AST.

Still, currently C-M-b jumps back way too far even if we accept that.

An example is here:

    my_test(X) :-
            goal1,
            goal2,
            goal3.
    
    %?- my_test(X).HERE

Notice the comment on the last line is an embedded query that I can
evaluate for example with ediprolog. When I press C-M-b in that
situation, point is moved even before the whole snippet (!), whereas I
get, with the mode supplied by Stefan Bruda:

    my_test(X) :-
            goal1,
            goal2,
            goal3.
    
    %?- my_testHERE(X).

i.e., point is moved to a sensible position within that query, and we
obtain the property that from then on, C-M-f and C-M-b can be used
repeatedly to cycle between two positions, making it easier to navigate
consistently between symbolic expressions. Please reconsider the
criteria that determine how much C-M-b and C-M-f should skip, so that
the mode does not skip beyond the intuitively expected positions.

Thank you and all the best,
Markus