What can cause this problem? Is it caused by Emacs or it is due to my pc's performance? Generally what are the variables that affect Emacs' performance?
Emacs has around 50,000 internal variables and a few thousand external packages averaging at a few dozen variables each, you can't expect someone to answer this in a general sense. :-)
You can see that just by looking at the comments thread under your question. There are half a dozen different suggestions in there, all equally valid.
What can you do to pinpoint the problem?
Option 1: Disable modes
Start disabling those minor-modes you've listed, and see which one solves you performance issue. I would start with
font-lock, and then follow down the list.
"I didn't have this problem yesterday" means very little, don't rely on it too heavily. Just start disabling minor-modes until something solves it.
If none of the minor-modes fix your issue, then start commenting out portions of your init file until you find out which snippet was causing this. In any case, ask a new question when you have something more specific.
Option 2: The profiler
M-x profiler-start RET RET (the second
RET is to confirm
- Do some typing, preferably an entire paragraph or more;
That will give you a buffer describing the cpu time taken by each function. Hitting
TAB on a line expands it to display the functions inside it.
Navigate this buffer until you find out which function is taking so much CPU time.
What do I do afterwards?
Once you find the function or package or snippet causing lag you can (in no particular order):
- Ask a new question here regarding that specific minor-mode (or function or snippet).
- Report a bug to the package maintainer.
- Check the comments at the top of the package's source file. If it contains a URL (specially on github), there's probably an issue tracker there.
- Some packages offer a command like
- His or her email should be at the top of the package's source file.
- If it's a built-in package, you can report it with
- Even for packages that are not built-in, you can ask for help at the
help-gnu-emacs mailing list.