Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sporadically when I open a large file in emacs it will hang forever, except the GUI will remain responsive! I can move my mouse between frames and the cursor will fill in, hovering over files in dired mode still highlights them, etc. but clicking doesn't cause any action to actually be performed. Ideally of course whatever bug is in emacs will get fixed eventually, but for now, is there anyway I can interrupt emacs loading the file, or change my .emacs to make it interruptible? Ctrl+G doesn't work.

Clarification: I'm trying not to lose my work -- so I mean interrupt emacs without killing it, as in, have it return to just how it was before I tried opening the file.

share|improve this question

migrated from Oct 31 '10 at 11:56

This question came from our site for system and network administrators.

Have you tried escape 3 times? ESC ESC ESC – kjfletch Oct 30 '10 at 19:33
yes, doesn't help. – momeara Feb 4 '14 at 2:53
up vote 5 down vote accepted

I use the following hook to force Emacs to open large files in fundamental mode, read only, and without undo. This does speed up viewing large files as avoids any time spent during fontification. I've found this to be helpful behavior, and I can always turn on any of those features easily if I want. UPDATE - fixed typo with find-file-hook.

(defun my-find-file-check-make-large-file-read-only-hook ()
  "If a file is over a given size, make the buffer read only."
  (when (> (buffer-size) (* 10 1024 1024))
    (setq buffer-read-only t)
    ; (message "Buffer is set to read-only because it is large.  Undo also disabled.")

(add-hook 'find-file-hook 'my-find-file-check-make-large-file-read-only-hook)
share|improve this answer
Very good idea, thanks. – Joseph Garvin Nov 9 '10 at 3:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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