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.

  • 1
    [mhtml-mode is default for *.html files in emacs 26.1[(git.savannah.gnu.org/cgit/emacs.git/commit/etc/…) 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 for details
    – matteol
    May 19 '18 at 5: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 4 '18 at 2:53

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.