Michel Alexandre Salim 0e14ac
From 462ca0654d2aa2a2b6506f2e9a1a9ceb8e683cad Mon Sep 17 00:00:00 2001
Michel Alexandre Salim 0e14ac
From: Gregory Heytings <gregory@heytings.org>
Michel Alexandre Salim 0e14ac
Date: Sun, 25 Apr 2021 10:33:48 +0000
Michel Alexandre Salim 0e14ac
Subject: [PATCH] Fix infloop in Modula-2 mode
Michel Alexandre Salim 0e14ac

Michel Alexandre Salim 0e14ac
* lisp/progmodes/modula2.el (m2-smie-refine-colon): Stop looping when
Michel Alexandre Salim 0e14ac
point does not move with forward-sexp (Bug#48011)
Michel Alexandre Salim 0e14ac
---
Michel Alexandre Salim 0e14ac
 lisp/progmodes/modula2.el | 5 ++++-
Michel Alexandre Salim 0e14ac
 1 file changed, 4 insertions(+), 1 deletion(-)
Michel Alexandre Salim 0e14ac

Michel Alexandre Salim 0e14ac
diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el
Michel Alexandre Salim 0e14ac
index 2a0374aa81..5756d91831 100644
Michel Alexandre Salim 0e14ac
--- a/lisp/progmodes/modula2.el
Michel Alexandre Salim 0e14ac
+++ b/lisp/progmodes/modula2.el
Michel Alexandre Salim 0e14ac
@@ -201,7 +201,10 @@ m2-smie-refine-colon
Michel Alexandre Salim 0e14ac
          ((zerop (length tok))
Michel Alexandre Salim 0e14ac
           (let ((forward-sexp-function nil))
Michel Alexandre Salim 0e14ac
             (condition-case nil
Michel Alexandre Salim 0e14ac
-                (forward-sexp -1)
Michel Alexandre Salim 0e14ac
+                (let ((p (point)))
Michel Alexandre Salim 0e14ac
+                  (forward-sexp -1)
Michel Alexandre Salim 0e14ac
+                  (if (= p (point))
Michel Alexandre Salim 0e14ac
+                      (setq res ":")))
Michel Alexandre Salim 0e14ac
               (scan-error (setq res ":")))))
Michel Alexandre Salim 0e14ac
          ((member tok '("|" "OF" "..")) (setq res ":-case"))
Michel Alexandre Salim 0e14ac
          ((member tok '(":" "END" ";" "BEGIN" "VAR" "RECORD" "PROCEDURE"))
Michel Alexandre Salim 0e14ac
-- 
Michel Alexandre Salim 0e14ac
2.30.2
Michel Alexandre Salim 0e14ac