unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
To: 33744@debbugs.gnu.org
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	[thread overview]
Message-ID: <cf7e4e85891a3ce65c4f2b869c9021f8@ludovic-brenta.org> (raw)

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.





             reply	other threads:[~2018-12-14 15:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 15:57 Ludovic Brenta [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf7e4e85891a3ce65c4f2b869c9021f8@ludovic-brenta.org \
    --to=ludovic@ludovic-brenta.org \
    --cc=33744@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).