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

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

bug#33744: 26.1; ada-mode 6.0.0 indentation of operators starting a line


From: Ludovic Brenta
Subject: bug#33744: 26.1; ada-mode 6.0.0 indentation of operators starting a line in a multi-line expression
Date: Fri, 14 Dec 2018 16:57:17 +0100

Package: emacs, ada-mode
X-Debbug-CC: address@hidden

Hello, consider the line marked "incorrectly indented" below:

procedure Operator_Indentation is
begin
  if B
       or else C
       > 2 -- incorrectly indented
  then
    null;
  end if;
end Operator_Indentation;

We think the indentation performed by ada-mode 6.0.0 is incorrect.
Of course we understand that the line is indented relative to B
but as this line is part of a sub-expression, we think it should be
indented relative to the sub-expression instead.  We cannot decide
which of the two following alternatives is the most "correct":

procedure Operator_Indentation is
begin
  if B
       or else C
         > 2 -- indented relative to "or else"
  then
    null;
  end if;
end Operator_Indentation;

procedure Operator_Indentation is
begin
  if B
       or else C
> 2 -- indented relative to C, which starts the sub-expression
  then
    null;
  end if;
end Operator_Indentation;

(we set ada-indent to 2).

Of course, these examples are overly simplified; in our real code base,
we don't write our operators on a separate line unless the previous line
("C" in these examples) is very long. To illustrate this, our actual code
looks more like:

procedure Operator_Indentation is
begin
  if Blarg_Meets_Preconditions_For_Subsequent_Test (Blarg)
or else Critical_Cruising_Configuration_Condition_Code (Blarg.Blurp)
         > 2
  then
    null;
  end if;
end Operator_Indentation;

PS. The value of ada-indent-hanging-rel-exp has no effect in this
particular case.

--
Ludovic Brenta.





reply via email to

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