3

Under some very special conditions (namely, performing one particular edit in one particular HTML file), my Emacs session will freeze completely, and starts consuming ~100% of the CPU. The only course of action at this point is to put the poor beast to sleep (with well-aimed kill -9; it won't work without the -9).

I'm trying out characterize the conditions that lead to this behavior.

All I know is that it happens, as I wrote, when I perform a particular edit on this one particular file, AND the major mode for the file is mhtml. (The problem does not occur if I perform the same edit on that same file while the active mode is plain-ol' Fundamental.)

I can't figure out why mhtml is the initial major mode for this file (when I open it).

If I search for mhtml in my .emacs file, I get no hits. Is mhtml the default mode for HTML files?

(For what it's worth, the packages listed by list-packages do not mention mhtml at all.)

Bottom line is: I can't figure out what mhtml mode is, or why I'm getting it by default. It may be something I have in my .emacs, but if so, it's not obvious to me what it is.

kjo
  • 3,145
  • 14
  • 42
  • 1
    [`mhtml-mode` is default for `*.html` files in emacs 26.1[(http://git.savannah.gnu.org/cgit/emacs.git/commit/etc/NEWS?id=335174ee5037a2751c31bfd9ecb87cedb4bc3cda) I don't have emacs 26.1. So I cannot test it. Maybe, you can remove `nhtml-mode` from `auto-mode-alist`. – Tobias May 17 '18 at 13:04
  • 1
    It does not solve your problem, but when emacs is frozen you can try to send it the signal SIGUSR2, see [this answer](https://emacs.stackexchange.com/a/649/11725) for details – matteol May 19 '18 at 05:04
  • @matteol: Thank you!!! That's an extremely useful tip. – kjo May 19 '18 at 10:45
  • I also noticed that mhtml-mode has a problem with quotes within JavaScript comments when finding matching braces. I just installed web-mode, which does not have the comment problem and might also fix your freezing problem. – paulie4 Oct 04 '18 at 02:53

1 Answers1

4

mhtml-mode is defined in mhtml-mode.el. You can find it using M-x find-function mhtml-mode.

Other interesting commands for locating/finding libraries:

  • With M-x locate-library RET mhtml-mode RET the file name is displayed in the echo area.
  • With M-x find-library RET mhtml-mode RET the library file opened.
  • The help page for mhtml-mode contains a link to the file where that command is defined near the top. The help page can be opened with the command describe-function which is bound to C-h f mhtml-mode RET.
Tobias
  • 32,569
  • 1
  • 34
  • 75
Alex
  • 1,028
  • 5
  • 20