unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31551: 27.0.50; emacs hangs in hexl-mode on modula2 files
@ 2018-05-22 13:24 Alexandre Adolphe
  2018-06-05 15:30 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Adolphe @ 2018-05-22 13:24 UTC (permalink / raw)
  To: 31551

[-- 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 --]

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-06-22  3:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-22 13:24 bug#31551: 27.0.50; emacs hangs in hexl-mode on modula2 files Alexandre Adolphe
2018-06-05 15:30 ` 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

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).