From 8200c356a7058eb59355b15869c26284d593b357 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 17 Jan 2023 18:15:53 +0100
Subject: [PATCH] Emacs mode: fix indentation in blocks which are given options
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

E.g. indentation was incorrect following “model(block);”.

[skip ci]
---
 license.txt       | 2 +-
 scripts/dynare.el | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/license.txt b/license.txt
index 226011bdfd..e471efd484 100644
--- a/license.txt
+++ b/license.txt
@@ -299,7 +299,7 @@ License: GPL-2+ with Autoconf exception
 
 Files: scripts/dynare.el
 Copyright: 2010 Yannick Kalantzis
-           2019-2021 Dynare Team
+           2019-2023 Dynare Team
 License: GPL-3+
 
 Files: mex/sources/gensylv/gensylv.cc
diff --git a/scripts/dynare.el b/scripts/dynare.el
index bf8642b0da..a7558ca91a 100644
--- a/scripts/dynare.el
+++ b/scripts/dynare.el
@@ -216,7 +216,7 @@
                (setq cur-indent (current-indentation)))
               ((looking-at (concat "^[ \t]*" (eval-when-compile (regexp-opt
                                                                  dynare-blocks))
-                                   "[ \t]*;"))
+                                   "\\([ \t]*(.*)\\)?[ \t]*;")) ; NB: match block options if any
                ;; A block opening keyword was found: we need to indent an extra level
                (setq cur-indent (+ (current-indentation) dynare-block-offset))) ; Do the actual indenting
               ((bobp)
-- 
GitLab