Subject: Re: bug#36348: 26.2; Indentation problem with Delphi inline variables
From: Stefan Monnier <[email-masked]>
To: Pascal Quesseveur <[email-masked]>
Cc: [email-masked]
Date: Mon, 22 Jul 2019 13:12:04 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> Indentation doesn't work properly when using inline variable
> introduced by Delphi 10.3 (using Emacs 26.2, opascal,
> opascal-indent-level is 3):
>
>    for i := 0 to str.Length - 1 do
>       Write (str.Chars[i]);
>       
>    for var i := 0 to str.Length - 1 do
>               Write (str.Chars[i]);

I just pushed the patch below which seems to fix it.

        Stefan

diff --git a/lisp/progmodes/opascal.el b/lisp/progmodes/opascal.el
index 7d51816bf4..9bb62ced3b 100644
--- a/lisp/progmodes/opascal.el
+++ b/lisp/progmodes/opascal.el
@@ -1177,8 +1177,11 @@ opascal-enclosing-indent-of
           (throw 'done (opascal-stmt-line-indent-of
                         (or last-token token) opascal-indent-level)))
 
-         ;; We indent relative to an enclosing declaration section.
-         ((opascal-is token-kind opascal-decl-sections)
+         ;; We indent relative to an enclosing declaration section,
+         ;; unless this is within the a delimited expression
+         ;; (bug#36348).
+         ((and (not expr-delimited)
+               (opascal-is token-kind opascal-decl-sections))
           (throw 'done (opascal-indent-of (if last-token last-token token)
                                          opascal-indent-level)))