GNU bug report logs - #7736
24.0.50; perl-mode infinite loop

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Sun, 26 Dec 2010 00:19:01 UTC

Severity: normal

Found in version 24.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 7736-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: jidanni <at> jidanni.org
Cc: rfrancoise <at> debian.org, 7736-done <at> debbugs.gnu.org
Subject: Re: bug#7736: 24.0.50; perl-mode infinite loop
Date: Mon, 24 Jan 2011 15:13:07 -0500
> 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





This bug report was last modified 14 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.