bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stefan Monnier
Subject: bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct
Date: Mon, 05 Oct 2015 21:17:10 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> From that position, I press C-M-f, and get:

>    test :-
>            (   a,
>                b
>            ;   (   c,
>                    d
>                ;   e,
>                    f
>                ),
>                g,
>                hHERE
>            ).

That's not a bug, it's a feature: you jumped over all the
right-hand-side of the ";".  The old behavior is easy to get, but is
less useful.
Basically the new behavior lets you jump over "any" subtree in the AST,
whereas the old behavior only allowed you to jump over those subtrees
which are made of a single identifier or are delimited by parentheses.

E.g. if you want to swap the order of the two top-level alternatives in
the above example, just put point before or after the ";" and hit C-M-t.

> I tried navigating several such code snippets with Stefan Bruda's mode,
> starting from various positions. In all cases, the important invariant
> seems to be preserved that, give or take an offset of at most 1, we can
> invert a C-M-f with a subsequent C-M-b in most if not all situations
> that are of great practical importance when moving through Prolog code.

Not sure what you mean by "offset of at most 1".  E.g. with

     abd
     toto
     titi

starting at the end of "abd", after C-M-f I don't see how you can get
back to within 1 char of the original position with some number of C-M-b.

The new behavior is different, there's no doubt about it.  I think the
fact that it knows about infix operators and their relative precedence
is a great improvement, bringing sexp navigation closer to what you
get in Lisp.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]