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

Previous Next

Package: emacs;

Reported by: Markus Triska <triska <at> metalevel.at>

Date: Sun, 20 Sep 2015 16:21:01 UTC

Severity: minor

Found in version 24.5

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #113 received at 21526 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Markus Triska <triska <at> metalevel.at>
Cc: 21526 <at> debbugs.gnu.org
Subject: Re: bug#21526: 24.5;
 prolog-mode: broken indentation for if-then-else construct
Date: Mon, 05 Oct 2015 21:17:10 -0400
>> 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




This bug report was last modified 4 years and 269 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.