[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7736: 24.0.50; perl-mode infinite loop
From: |
Stefan Monnier |
Subject: |
bug#7736: 24.0.50; perl-mode infinite loop |
Date: |
Mon, 24 Jan 2011 15:13:07 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> Man, you gotta see this. On this attached file,
> save in /tmp, and run emacs -Q -nw /tmp/r.pl
> Now move the cursor down and attempt to change shttp to s[http .
> As you insert the [ an infinite loop begins.
Indeed, thanks for that test case. I've installed the patch below
which should fix the problem.
Stefan
=== modified file 'lisp/progmodes/perl-mode.el'
--- lisp/progmodes/perl-mode.el 2011-01-14 17:18:41 +0000
+++ lisp/progmodes/perl-mode.el 2011-01-24 20:05:18 +0000
@@ -360,7 +360,8 @@
(t
;; This is regexp like quote thingy.
(setq char (char-after (nth 8 state)))
- (let ((twoargs (save-excursion
+ (let ((startpos (point))
+ (twoargs (save-excursion
(goto-char (nth 8 state))
(skip-syntax-backward " ")
(skip-syntax-backward "w")
@@ -384,7 +385,8 @@
(goto-char (1+ (nth 8 state)))
(up-list 1)
t)
- (scan-error nil))
+ ;; In case of error, make sure we don't move backward.
+ (scan-error (goto-char startpos) nil))
(not (or (nth 8 (parse-partial-sexp
(point) limit nil nil state 'syntax-table))
;; If we have a self-paired opener and a twoargs