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: Markus Triska
Subject: bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct
Date: Tue, 06 Oct 2015 18:45:16 +0200

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 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.

I would like to test the mode more seriously, and the most impeding
aspect of the new navigation is currently that Prolog terms within
comments are skipped over way too far, and comments in general make the
mode's navigation hard to predict in my view.  Consider for example:

   % Hello,
   % there.

   it_is_a_fact.

   %?- test(a,b).HERE

In that sitation, pressing C-M-b yields:

   HERE% Hello,
   % there.

   it_is_a_fact.

   %?- test(a,b).

However, when I press C-M-b for example with:

   x.

   % Hello,
   % there.

   it_is_a_fact.

   %?- test(a,b).HERE

Then I get:

   x.

   % Hello,
   % there.

   HEREit_is_a_fact.

   %?- test(a,b).

Thus, syntactic constructs that are comparatively far away from the
Prolog terms near point influence the navigation with C-M-b. In this
case, placing the fact x/0 at the beginning made the mode NOT jump over
a fact and a comment, whereas it otherwise jumps over both of them.

In other modes I tested, syntactic elements of the language are handled
as expected also within comments when using C-M-b and C-M-f.

For example, in the case of Prolog, we have with the recent git version:

   ?- test(a,b).
   ?- test(x,y).HERE

Pressing C-M-b yields, as expected:

   ?- test(a,b).
   HERE?- test(x,y).

The reason is clear: The Prolog term ?-(test(x,y)) is the one that
immediately precedes point, and pressing C-M-b jumps precisely over it.

However, when both of these terms are commented, as in:

   %?- test(a,b).
   %?- test(x,y).HERE

then pressing C-M-b skips over both of them, and, depending on what
appears before these lines, may move away even further than that.

This is completely unexpected and unusual in Emacs modes: In other modes
I tested (C, Lisp etc.), C-M-b and C-M-f behave very consistently, also
if the syntactic elements they usually jump over arise in comments.

In the case of Prolog though, it is particularly unfortunate because of
tools like ediprolog that encourage users to embed Prolog terms as
queries in comments, and pressing C-M-b with the expectation to move to
the beginning of such terms will in general move point to a position
that is much further away, and from where it is not easy to get back.

Please consider reinstating the navigation that was previously
available, or making the current navigation work better with comments.

Thank you and all the best,
Markus





reply via email to

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