]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/opascal.el: Allow inline `var` decl in `for` (bug#36348)
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 22 Jul 2019 17:10:35 +0000 (13:10 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 22 Jul 2019 17:10:35 +0000 (13:10 -0400)
(opascal-enclosing-indent-of): Ignore decls "neutered" by delimiter.

lisp/progmodes/opascal.el
test/manual/indent/opascal.pas [new file with mode: 0644]

index 7d51816bf40f127286a451a55eb64dbba040a12e..9bb62ced3bde31dec21e067985ee63900524cbbc 100644 (file)
@@ -1177,8 +1177,11 @@ routine.")
           (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)))
 
diff --git a/test/manual/indent/opascal.pas b/test/manual/indent/opascal.pas
new file mode 100644 (file)
index 0000000..ac4beb3
--- /dev/null
@@ -0,0 +1,12 @@
+{ -*- opascal -*- }
+
+procedure Toto ();
+begin
+   for i := 0 to 1 do
+      Write (str.Chars[i]);
+
+   // bug#36348
+   for var i := 0 to 1 do
+      Write (str.Chars[i]);
+
+end;