all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: jidanni@jidanni.org
Cc: rfrancoise@debian.org, 7736-done@debbugs.gnu.org
Subject: bug#7736: 24.0.50; perl-mode infinite loop
Date: Mon, 24 Jan 2011 15:13:07 -0500	[thread overview]
Message-ID: <jwvsjwim5eh.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87r5d655rt.fsf@jidanni.org> (jidanni@jidanni.org's message of "Sat, 25 Dec 2010 21:41:26 +0800")

> 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






      parent reply	other threads:[~2011-01-24 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-25 13:41 bug#7736: 24.0.50; perl-mode infinite loop jidanni
2011-01-23  1:18 ` Chong Yidong
2011-01-24  0:53   ` Stefan Monnier
2011-01-24 20:13 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvsjwim5eh.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=7736-done@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    --cc=rfrancoise@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.