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

From: Markus Triska <[email-masked]>
Date: Wed, 30 Sep 2015 08:38:45 +0200

Stefan Monnier <[email-masked]> writes:

>> (c) Arguments of directives should be more indented.  For example, a
>> directive whose arguments span several lines should look like this:
>>
>>    :- multifile
>>            pred1,
>>            pred2,
>>            pred3.
>
> I have no idea what "directives" are nor what the above "multifile"
> means nor what is its syntax.  Does Bruda's code handle that?

Yes. All issues I reported so far are deviations from Stefan Bruda's
original version. His version also highlights DCG heads with zero
arguments correctly.

A directive starts with :- or ?- in a source file.

>
>> `prolog-keywords' contains the directives where a hanging indentation of
>> prolog-indent-width in subsequent lines would be very welcome.
>
> That's vague: what means "subsequent lines"?
> Anything until a "."?  What about a ";" or a ":-" or a "-->"?

(:-)/1 can be read just like a Prolog rule, only without head. So, after
:-, I expect the same indentation like in a rule. A directive can
include any regular Prolog goal.

>>    test_predicate(c) :- !,
>>            test_goal1,
>>            test_goal2.
> Should work now.

Awesome, thank you!

Regarding comments, one more thing I noticed is that in a multiline
comment like /* ... */, we actually expect a small indentation like:

/*
  Hello, indented world!
*/

as in the default C mode, but currently get:

/*
Not indented.
*/

In Stefan Bruda's version, we get the former layout.

All the best,
Markus