From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 31551@debbugs.gnu.org, Alexandre Adolphe <alexandre.adolphe@gmail.com>
Subject: bug#31551: 27.0.50; emacs hangs in hexl-mode on modula2 files
Date: Wed, 06 Jun 2018 10:00:04 -0400 [thread overview]
Message-ID: <jwvbmcom3gi.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <83r2ll9rny.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 05 Jun 2018 18:30:57 +0300")
>> 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.
Clearly, this is a bug in m2-smie-refine-colon, indeed (not a big
surprise: you're the first user of Modual-2 I encounter since I wrote
that indentation code).
> Hmm... I think there's a more serious issue at hand here. Hexl mode
> is not a normal major mode: it doesn't undo the effects of the
> previous major mode.
Indeed, it fails to call kill-all-local-variables. It justifies it with:
;; We do not turn off the old major mode; instead we just
;; override most of it. That way, we can restore it perfectly.
which I find unconvincing.
> So what happens here is that the display is entirely inappropriate for
> Modula2 sources, but the syntactic setup made by m2-mode is still in
> effect, and that setup attaches special meaning to ':' when scanning
> for parentheses.
Right, it failed to "unsetup" SMIE.
> On top of that, show-paren-mode will happily turn itself on in a
> buffer under Hexl mode, although it makes no sense to me: the Hexl
> display shows no parens to work with.
At the same time, it's only enabled if the user explicitly requests it
(as is the case in the OP's recipe), so I think we can consider this
a pilot error.
> The fact that syntactical customizations of a mode stay in effect when
> the display changes so radically sounds like a potential cause of many
> trouble. So perhaps the right solution would be to temporarily
> disable mode syntax while in Hexl mode.
Agreed. Hexl-mode should use a "normal" major mode (e.g. calling
kill-all-local-variables). In order to properly reset the previous
major mode, it could either save&restore all previous local-vars, or
just save the previous major-mode and call that major-mode
function to restore the state.
BTW, this "save previous major mode and then restore it" is something
done in other places (at least doc-view-mode comes to mind, but
I believe there are others as well) and we should try and avoid
duplicating that code (i.e. develop a "standard" way to do it).
Stefan
next prev parent reply other threads:[~2018-06-06 14:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvbmcom3gi.fsf-monnier+emacsbugs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=31551@debbugs.gnu.org \
--cc=alexandre.adolphe@gmail.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.