]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix infloop in Modula-2 mode
authorGregory Heytings <gregory@heytings.org>
Tue, 25 May 2021 04:18:29 +0000 (06:18 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 25 May 2021 04:18:29 +0000 (06:18 +0200)
* lisp/progmodes/modula2.el (m2-smie-refine-colon): Stop looping
when point does not move with forward-sexp (Bug#48011).

lisp/progmodes/modula2.el

index 2a0374aa8184772f19e5271b056296aca9f6f596..a8d644dba0ec43d31d77ce4bd56b26b18bb0222d 100644 (file)
          ((zerop (length tok))
           (let ((forward-sexp-function nil))
             (condition-case nil
-                (forward-sexp -1)
+                (let ((p (point)))
+                  (forward-sexp -1)
+                  (when (= p (point))
+                    (setq res ":")))
               (scan-error (setq res ":")))))
          ((member tok '("|" "OF" "..")) (setq res ":-case"))
          ((member tok '(":" "END" ";" "BEGIN" "VAR" "RECORD" "PROCEDURE"))