I'm curious about the Emacs architecture. Do you know where are the structures for keeping opened text file? Where are the main functions for opening, editing and closing text files? How in general terms text is stored.

I once opened one xml file, which was 100 MiB large and had only two lines of text. Then I typed a character in the large one, emacs stopped reacting for a several minutes with a 100% cpu usage. So, I guess, emacs did kept that 100 MiB line as a single memory block, and moved 99.999999 of them to the right then this happened. I'm curious where exactly in the code this happened, what's the file name + function name.

  • It is very likely that the performance problem is caused by font-lock. Try M-x fundamental-mode and type again a character.
    – Tobias
    Commented Dec 26, 2015 at 19:03
  • @Tobias huh, that did speed up things quite a lot, thanks. (And I probably mistaken there, it waits only for 5 seconds instead of 5 minutes. Or maybe I changed something since then and forgot about it. Doesn't matter, thanks) Commented Dec 26, 2015 at 19:19
  • 2
    "100 MiB large and had only two lines of text" - see emacs.stackexchange.com/questions/598/… and Emacs bug#13675. Also see (elisp) Buffer Gap
    – npostavs
    Commented Dec 26, 2015 at 19:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.