all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gregory Heytings <gregory@heytings.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "Dan Čermák" <dan.cermak@cgc-instruments.com>, 48011@debbugs.gnu.org
Subject: bug#48011: 27.2; Emacs freezes in modula 2 mode when entering a :
Date: Sun, 25 Apr 2021 10:37:10 +0000	[thread overview]
Message-ID: <677a04021bcb852ed91a@heytings.org> (raw)
In-Reply-To: <83v98alp0a.fsf@gnu.org>

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


>
> I cannot reproduce this using the recipe in the Bugzilla report, neither 
> in Emacs 27.2 nor in the current master branch.  I see no hang.
>

The recipe isn't precise enough:

emacs -Q foo.mod
set SPC PROD SPC : SPC

Emacs hangs after the second SPC.  This bug is an old one, Emacs 24 has 
the same problem.  In fact an ever shorter recipe also works:

emacs -Q foo.mod
: SPC

>
> If C-g interrupts the hang, please set debug-on-signal non-nil, repeat 
> the recipe, press C-g, and post the Lisp backtrace here.
>

You probably meant "debug-on-quit".  Here is the backtrace:

smie-default-backward-token()
m2-smie-refine-colon()
m2-smie-backward-token()
smie-blink-matching-open()
self-insert-command(1 32)
funcall-interactively(self-insert-command 1 32)
call-interactively(self-insert-command nil nil)
command-execute(self-insert-command)

And here is the patch.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=Fix-infloop-in-Modula-2-mode.patch, Size: 1143 bytes --]

From 462ca0654d2aa2a2b6506f2e9a1a9ceb8e683cad Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Sun, 25 Apr 2021 10:33:48 +0000
Subject: [PATCH] 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)
---
 lisp/progmodes/modula2.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el
index 2a0374aa81..5756d91831 100644
--- a/lisp/progmodes/modula2.el
+++ b/lisp/progmodes/modula2.el
@@ -201,7 +201,10 @@ m2-smie-refine-colon
          ((zerop (length tok))
           (let ((forward-sexp-function nil))
             (condition-case nil
-                (forward-sexp -1)
+                (let ((p (point)))
+                  (forward-sexp -1)
+                  (if (= p (point))
+                      (setq res ":")))
               (scan-error (setq res ":")))))
          ((member tok '("|" "OF" "..")) (setq res ":-case"))
          ((member tok '(":" "END" ";" "BEGIN" "VAR" "RECORD" "PROCEDURE"))
-- 
2.30.2


  reply	other threads:[~2021-04-25 10:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25  7:53 bug#48011: 27.2; Emacs freezes in modula 2 mode when entering a : Dan Čermák
2021-04-25  8:58 ` Eli Zaretskii
2021-04-25 10:37   ` Gregory Heytings [this message]
2021-04-26 10:40     ` Dan Čermák
2021-04-26 12:18       ` Eli Zaretskii
2021-05-25  4:18     ` Lars Ingebrigtsen
2021-05-25 13:02 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-25 13:09   ` Gregory Heytings
2021-05-25 14:47     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=677a04021bcb852ed91a@heytings.org \
    --to=gregory@heytings.org \
    --cc=48011@debbugs.gnu.org \
    --cc=dan.cermak@cgc-instruments.com \
    --cc=eliz@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.