summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2021-05-25 06:18:29 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-05-25 06:18:29 +0200
commit0b48e2d258cb3c0ad5d12c5b4aaf9b4b69101763 (patch)
tree46248d381028e132b35082c0498e21f1eeb051d7
parent86e4d770a833538f3cb711eb42d8fd8d764a4635 (diff)
downloademacs-0b48e2d258cb3c0ad5d12c5b4aaf9b4b69101763.tar.gz
Fix infloop in Modula-2 mode
* lisp/progmodes/modula2.el (m2-smie-refine-colon): Stop looping when point does not move with forward-sexp (Bug#48011).
-rw-r--r--lisp/progmodes/modula2.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el
index 2a0374aa818..a8d644dba0e 100644
--- a/lisp/progmodes/modula2.el
+++ b/lisp/progmodes/modula2.el
@@ -201,7 +201,10 @@
((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"))