unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alexandre Adolphe <alexandre.adolphe@gmail.com>
To: 31551@debbugs.gnu.org
Subject: bug#31551: 27.0.50; emacs hangs in hexl-mode on modula2 files
Date: Tue, 22 May 2018 15:24:09 +0200	[thread overview]
Message-ID: <CAK73JcA28eiOcWFQcCraEru1fwVOoC0Gth6BrO6TTT7nceHsQA@mail.gmail.com> (raw)

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

Hi,

I run into an issue lately while trying to use the hexl-mode with
a modula2 file that I found and emacs starts to hang after the
hexl-mode starts. I tested it on emacs 24.5, 25.2 and master.

To reproduce the issue you can use :
echo "abcd" > test.MOD
emacs -Q --eval '(show-paren-mode 1)' test.MOD
M-x hexl-mode

--> emacs hangs and use 100% cpu. It only happen on the first character so
we can run out the hang with multiple C-g + an arrow key.

I dig into the issue and it appears that the was because of the
show-paren-mode and the fact that the ":" character have meaning in
modula-2-mode. Emacs is stuck in the loop of the
m2-smie-refine-colon function because after the "00000000" that start
the hexl buffer there is no more sexp to parse so the tok variable is
empty but the (forward-sexp -1) call does not fail.

I fixed that myself by stopping the loop if the point is at the beginning
of the buffer. Not sure if it correct but here is the diff :

diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el
index 582e495..30c8c46 100644
--- a/lisp/progmodes/modula2.el
+++ b/lisp/progmodes/modula2.el
@@ -203,6 +203,7 @@ m2-smie-refine-colon
     (while (not res)
       (let ((tok (smie-default-backward-token)))
         (cond
+         ((= (point) (point-min)) (setq res ":"))
          ((zerop (length tok))
           (let ((forward-sexp-function nil))
             (condition-case nil


I am not really into modula2 files but this bug was quite surprising.

best regards,
Alexandre

[-- Attachment #2: Type: text/html, Size: 1837 bytes --]

             reply	other threads:[~2018-05-22 13:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 13:24 Alexandre Adolphe [this message]
2018-06-05 15:30 ` bug#31551: 27.0.50; emacs hangs in hexl-mode on modula2 files Eli Zaretskii
2018-06-06 14:00   ` Stefan Monnier
2018-06-06 15:17     ` Eli Zaretskii
2018-06-06 19:27       ` Stefan Monnier
2018-06-07  2:32         ` Eli Zaretskii
2018-06-06 20:51       ` Stefan Monnier
2018-06-20 14:27         ` Stefan Monnier
2018-06-20 15:56           ` Eli Zaretskii
2018-06-22  3:31           ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAK73JcA28eiOcWFQcCraEru1fwVOoC0Gth6BrO6TTT7nceHsQA@mail.gmail.com \
    --to=alexandre.adolphe@gmail.com \
    --cc=31551@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).