all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Harald Jörg" <haj@posteo.de>
To: 10483@debbugs.gnu.org
Subject: bug#10483: [PATCH] cperl-mode: Avoid endless loop
Date: Mon, 31 Aug 2020 19:06:08 +0200	[thread overview]
Message-ID: <dafd26df-acf2-1c6a-2526-880e9ed84461@posteo.de> (raw)
In-Reply-To: <CAHZoxq_P5cHGnJuPFR-10WLUbrUKiWOznwXwTjmsqa7jTyLOrA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 167 bytes --]

That bug has a few more manifestations. An endless loop
occurred whenever a statement ended in a closing paren, and
the statement was not terminated on the same line.

[-- Attachment #2: 0001-2020-08-31-Harald-J-rg-haj-posteo.de.patch --]
[-- Type: text/x-patch, Size: 1753 bytes --]

From 325dc859a5ed9a912f15ec4e7e123b3fe3bde299 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Harald=20J=C3=B6rg?= <haj@posteo.de>
Date: Mon, 31 Aug 2020 18:35:53 +0200
Subject: [PATCH] =?UTF-8?q?2020-08-31=20=20Harald=20J=C3=B6rg=20=20<haj@po?=
 =?UTF-8?q?steo.de>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

 * lisp/progmodes/cperl-mode.el (cperl-indent-exp): Fix (Bug#10483)
 Perl expressions (e.g. function calls) ending in ")" without
 statement terminator on the same line no longer loop endlessly.
---
 lisp/progmodes/cperl-mode.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 44579cfd38..f6ad0b7e6d 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -4820,9 +4820,10 @@ cperl-indent-exp
 	  (while (< (point) tmp-end)
 	    (parse-partial-sexp (point) tmp-end nil t) ; To start-sexp or eol
 	    (or (eolp) (forward-sexp 1)))
-	  (if (> (point) tmp-end)	; Yes, there an unfinished block
+	  (if (> (point) tmp-end)	; Check for an unfinished block
 	      nil
 	    (if (eq ?\) (preceding-char))
+		;; closing parens can be preceded by up to three sexps
 		(progn ;; Plan B: find by REGEXP block followup this line
 		  (setq top (point))
 		  (condition-case nil
@@ -4843,7 +4844,9 @@ cperl-indent-exp
 			    (progn
 			      (goto-char top)
 			      (forward-sexp 1)
-			      (setq top (point)))))
+			      (setq top (point)))
+			  ;; no block to be processed: expression ends here
+			  (setq done t)))
 		    (error (setq done t)))
 		  (goto-char top))
 	      (if (looking-at		; Try Plan C: continuation block
-- 
2.20.1


  reply	other threads:[~2020-08-31 17:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-12  0:02 bug#10483: 24.0.92; cperl-indent-exp hangs Eric Hanchrow
2020-08-31 17:06 ` Harald Jörg [this message]
2020-08-31 17:24   ` bug#10483: [PATCH] cperl-mode: Avoid endless loop Eli Zaretskii
2020-08-31 18:08     ` Harald Jörg
2020-08-31 18:49       ` Eli Zaretskii
2020-08-31 21:23         ` Stefan Kangas
2020-09-01 16:12         ` Harald Jörg
2020-09-04  3:17           ` Lars Ingebrigtsen
2020-09-04  7:15             ` Eli Zaretskii
2020-09-04 10:41               ` Lars Ingebrigtsen
2020-09-04 10:51                 ` Andreas Schwab
2020-09-04 10:55                   ` Lars Ingebrigtsen
2020-09-04 11:36                     ` Eli Zaretskii
2020-09-04 12:00                       ` Lars Ingebrigtsen
2020-09-04 12:05                     ` Andreas Schwab
2020-09-04 11:34                 ` Eli Zaretskii
2020-09-04 11:59                   ` Lars Ingebrigtsen
2020-09-04 12:28                     ` Eli Zaretskii
2020-09-04 12:36                       ` Lars Ingebrigtsen
2020-09-04 12:09                   ` Andreas Schwab
2020-10-05 18:30 ` bug#10483: [PATCH] Fix a bogus test introduced by treating (Bug#10483) Harald Jörg
2020-10-06  1:40   ` Lars Ingebrigtsen

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=dafd26df-acf2-1c6a-2526-880e9ed84461@posteo.de \
    --to=haj@posteo.de \
    --cc=10483@debbugs.gnu.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.