From 4dd54f5ffd78ebe411e6d88d49ed9464a9fd0e1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 25 Feb 2020 12:41:04 +0100
Subject: [PATCH] Emacs mode: fix byte compilation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The Emacs lisp source file was failing byte-compilation, because the
“dynare-blocks” variable was used within an “eval-when-compile” block, while
its definition was not in such a block.

(cherry picked from commit 3a0327d37926db1a16f8cea0b012721e5542ab3e)
---
 scripts/dynare.el | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/scripts/dynare.el b/scripts/dynare.el
index 8539fed3d4..4a174b205a 100644
--- a/scripts/dynare.el
+++ b/scripts/dynare.el
@@ -88,15 +88,18 @@
 
 ;; Those keywords that makes the lexer enter the DYNARE_BLOCK start condition
 ;; Also include "verbatim" in this list
-(defvar dynare-blocks
-  '("model" "steady_state_model" "initval" "endval" "histval" "shocks"
-    "shock_groups" "init2shocks" "mshocks" "estimated_params" "epilogue" "priors"
-    "estimated_params_init" "estimated_params_bounds" "osr_params_bounds"
-    "observation_trends" "optim_weights" "homotopy_setup"
-    "conditional_forecast_paths" "svar_identification" "moment_calibration"
-    "irf_calibration" "ramsey_constraints" "restrictions" "generate_irfs"
-    "verbatim")
-  "Dynare block keywords.")
+;; Needs to be enclosed within eval-when-compile, because this variable is
+;; referenced in another eval-when-compile statement in dynare-calculate-indentation
+(eval-when-compile
+  (defvar dynare-blocks
+    '("model" "steady_state_model" "initval" "endval" "histval" "shocks"
+      "shock_groups" "init2shocks" "mshocks" "estimated_params" "epilogue" "priors"
+      "estimated_params_init" "estimated_params_bounds" "osr_params_bounds"
+      "observation_trends" "optim_weights" "homotopy_setup"
+      "conditional_forecast_paths" "svar_identification" "moment_calibration"
+      "irf_calibration" "ramsey_constraints" "restrictions" "generate_irfs"
+      "verbatim")
+    "Dynare block keywords."))
 
 ;; Mathematical functions and operators used in model equations (see "hand_side" in Bison file)
 (defvar dynare-functions
-- 
GitLab