1

issue issue2

Problem

There is severe lag(>10s some times) in my markdown document (14k words) which I run within emacs. It appears that Markdown-mode seems to be computing something everysingle time I type any character and renders emacs unusable. I suspect it has to do with the above 2 pictures. The color rendering changes with every character.

Profiling was done and the contents is in this paste bin. There seems to be the font-lock-fontify-keywords-region function that seems to be run twice, once as part of redisplay_internal C function (50%) and the other is the command execute (42%) function.

Further more the issue vanishes or is under much better control once indirect buffer is not running anymore. I need some guidance as to how to go further.

Things I did

Re-installed markdown-mode (to the latest available one), looked for a while on stack. Tried to remove the coloring scheme from my init file, but it still is there somehow. I use forward slashes or other special characters and checked with general syntax and that doesn't seem to be the issue. It exists even with very few characters.

When I copy and paste the same thing into another file, somehow it works well for now without any of the color rendering issues, but within a few days, I am back to the same thing.

Info

I am running Markdown mode on my Emacs 25.3.2 based on this installation on Ubuntu 16 on Acer Nitro 5 1050 GTX graphics card with 8gb ram.

Profiling

https://pastebin.com/QhGH1Nat

Running the following minor modes

Auto-Composition Auto-Compression Auto-Encryption Auto-Fill Blink-Cursor Diff-Auto-Refine Electric-Indent File-Name-Shadow Flyspell Font-Lock Global-Eldoc Global-Font-Lock Line-Number Menu-Bar Mouse-Wheel Tool-Bar Tooltip Transient-Mark

init file

https://pastebin.com/FwsF390f

P.S I am very new to handling errors in emacs and I feel completely helpless without emacs to write now. Help me find my errors or atleast give me general diretions

  • 1
    It may be helpful for you to type C-h m and let the audience know what minor-modes are active that could be contributing to the issue. See also the forum threads/ and/or Emacs manual regarding how to use M-x profiler-start, M-x profiler-report and then M-x profiler-stop when you are done -- these will tell you what function is causing the largest cpu consumption. Common issues with a long lag have to deal with running the old linum-mode with folding of text in large buffers, dealing with very line long lines, dealing with very large files. – lawlist Jun 28 '18 at 20:13
  • @lawlist I am not running linum mode I think as it doesn't appear in the (updated) list of minor modes. I will check the profiler and get back. – Thej Kiran Jun 28 '18 at 20:40
  • @lawlist Can you please advice me further? I did the profiling and updated the post. For some reason on a fresh emacs start it is not that laggy, but over time it gets laggyer. – Thej Kiran Jun 30 '18 at 13:35
  • If the profiler is not helping, you may need to do it the old fashioned way; i.e., disable the minor-modes and see if the lag still occurs with only the major-mode and nothing else. If it does, then start looking at the file itself for certain characters that Emacs has trouble quickly understanding. If the major-mode all by itself with the file at issue has no problems, then start enabling one minor-mode at a time. If still no luck, then try zero user-configuration and just the bare minimum with the major-mode and the subject file. Unfortunately, there are too many possibilities to guess. – lawlist Jun 30 '18 at 15:42
  • You should also check your cpu consumption with a system monitor and see how much real memory Emacs is occupying when you start fresh and then check again when you notice the lag. Check the system monitor for the other Emacs related processes; e.g., the executable powering flyspell. Emacs 26 was released not too long ago, so it would be a good idea to see of your problem goes away with the newer version. Off hand, I do not know if 25.3.2 suffered from memory leaks or failure to garbage collect under certain rare circumstances .... – lawlist Jun 30 '18 at 15:54

Your Answer

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

Browse other questions tagged or ask your own question.