unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33744: 26.1; ada-mode 6.0.0 indentation of operators starting a line in a multi-line expression
@ 2018-12-14 15:57 Ludovic Brenta
  2018-12-21 23:14 ` bug#33744: effect of ada-indent-hanging-rel-exp Stephen Leake
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ludovic Brenta @ 2018-12-14 15:57 UTC (permalink / raw)
  To: 33744

Package: emacs, ada-mode
X-Debbug-CC: ada-mode-users@nongnu.org

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-08 11:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14 15:57 bug#33744: 26.1; ada-mode 6.0.0 indentation of operators starting a line in a multi-line expression Ludovic Brenta
2018-12-21 23:14 ` bug#33744: effect of ada-indent-hanging-rel-exp Stephen Leake
2018-12-23 17:39   ` Stephen Leake
2018-12-21 23:18 ` Stephen Leake
2019-01-08 11:47 ` bug#33744: 26.1; ada-mode 6.0.0 indentation of operators starting a line in a multi-line expression Ludovic Brenta

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).