[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: |
Wed, 30 Sep 2015 05:23:38 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> 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.
Hmm... I wonder how we lost this. Has it always highlighted those, or
is it something newish (e.g. newer than say Emacs-23.3)?
>>> (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.
> (:-)/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.
I don't understand. You say you want
:- multifile
pred1,
pred2,
pred3.
and you say that it is indented like in a normal rule, but in normal rule,
I expect neither
foo(X):- multifile
pred1,
pred2,
pred3.
nor
foo(X) :- multifile
pred1,
pred2,
pred3.
AFAIK the problem is not with the ":- without a left-hand side", but
with how to parse the
multifile
pred1,
pred2,
pred3
Currently it's parsed as:
(multifile
pred1),
pred2,
pred3
whereas clearly you'd like
multifile
(pred1,
pred2,
pred3)
hence my questions: What means "subsequent lines"?
Anything until a "."? What about a ";" or a ":-" or a "-->"?
IOW what should happen with something like
:- multifile
pred1;
pred2 -->
pred3.
Furthermore, it seems that this is linked to the (:-)/1 operator, so
what should happen if "multifile" appears elsewhere? what other keyword
can appear where you have "multifile" and do they all use this
same syntax?
> Regarding comments, one more thing I noticed is that in a multiline
> comment like /* ... */, we actually expect a small indentation like:
> as in the default C mode, but currently get:
>
> /*
> Not indented.
> */
Indeed, we have some problem here (it seems TAB doesn't even do
anything). Patch welcome.
Stefan
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Stefan Monnier, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Stefan Monnier, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Stefan Monnier, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Stefan Monnier, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Markus Triska, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct,
Stefan Monnier <=
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Markus Triska, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Stefan Monnier, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Markus Triska, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Stefan Monnier, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Markus Triska, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Stefan Monnier, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Markus Triska, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Stefan Monnier, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Markus Triska, 2015/10/08
- bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct, Stefan Monnier, 2015/10/08