I noticed Emacs was really laggy on any mode derived from prog-mode two days ago. Before that, everything was fine. I can navigate on a 1000+ lines org-mode file without problem, but I can't even type without lag on a 100- line of a C file, or a 50 lines Haskell file.

I have tried many things. I have disabled several modes to see if anything helps. It seems that disabling evil-mode helps, but doesn't solve it (and bare in mind, I use evil-mode on long org or LaTeX files without any lag).

I have also done the profiler on cpu (and memory, but only posted the cpu), and these are the results:

cpu: - command-execute 80022 75% - call-interactively 80022 75% - funcall-interactively 79047 74% - evil-scroll-line-up 77417 72% - scroll-down 76489 71% - jit-lock-function 76455 71% - jit-lock-fontify-now 76455 71% - apply 76455 71% - ad-Advice-jit-lock-fontify-now 76455 71% - #<compiled 0x267e7d> 76455 71% - jit-lock--run-functions 76451 71% - run-hook-wrapped 76451 71% - #<compiled 0xef9bd7> 76451 71% - highlight-indent-guides--guide-region 39739 37% - font-lock-fontify-region 39674 37% - font-lock-default-fontify-region 39671 37% - font-lock-fontify-keywords-region 39645 37% - eval 39636 37% - if 39636 37% - or 35672 33% - elt 35672 33% syntax-ppss 35140 33% + when 3402 3% + parse-partial-sexp 559 0% + font-lock-fontify-syntactically-region 11 0% + font-lock-unfontify-region 4 0% syntax-ppss 48 0% + highlight-indent-guides--get-prev-guides 11 0% + highlight-indent-guides--guide-line 3 0% - font-lock-fontify-region 36708 34% - font-lock-default-fontify-region 36708 34% - font-lock-fontify-keywords-region 36692 34% - eval 36679 34% - if 36673 34% - or 36666 34% - elt 36666 34% syntax-ppss 36660 34% + parse-partial-sexp 7 0% + font-lock-fontify-syntactically-region 7 0% + font-lock-unfontify-region 3 0% + nlinum--region 4 0% + run-with-timer 4 0% + eval 34 0%

The modes I have on are:

  • Async-Bytecomp-Package
  • Auto-Compile-On-Load
  • Auto-Fill
  • Column-Number
  • Diff-Auto-Refine
  • Evil
  • Evil-Commentary
  • Evil-Leader
  • Evil-Local
  • Evil-Surround
  • File-Name-Shadow
  • Flyspell
  • Global-Evil-Surround
  • Global-Git-Commit
  • Global-Nlinum-Relative
  • Global-Undo-Tree
  • Global-Yascroll-Bar
  • Haskell-Indentation
  • Helm
  • Highlight-Indent-Guides
  • Magit-Auto-Revert
  • Nlinum
  • Nlinum-Relative
  • Override-Global
  • Projectile
  • Savehist
  • Shell-Dirtrack
  • Show-Paren
  • Smart-Cursor-Color
  • Tex-Pdf
  • Undo-Tree
  • Yas-Global
  • Yascroll-Bar

If any more information is needed, I'll gladly provide, I don't know how to debug this very well.

  • 2
    Start emacs without your init file (emacs -Q). Then recursively bisect your init file until you isolate the problem. – Dan Dec 30 '17 at 19:15
  • Using the profiler is correct (and you can probably stick to the CPU profiler), but you haven't examined the results in enough detail. Don't worry about quoting the negligible impact items (e.g. anything showing "0%" CPU is clearly not a problem), but you do need to keep drilling down into those evil-scroll-line-up and evil-next-line items, until you have produced all of the data for those. – phils Dec 30 '17 at 20:34
  • What @Dan said. You really need to remove everything that is not directly relevant to the question from your question. After doing that, provide a step-by-step recipe to reproduce the problem starting from emacs -Q. – Drew Dec 30 '17 at 21:11
  • Ok, I'll edit the post to be a bit more specific on the problem. My init file is quite extensive, and I'm using org-mode to manage it (I'll link the init.el file from my github), but I don't think I understand what @Drew said about the "step-by-step to reproduce the problem starting from emacs -Q". Here's my emacs setup. – João Pedro Dec 31 '17 at 0:47
  • 4
    This is the point: Instead of tossing your whole init file at us, bisect it to find out just what the problem is. Then ask a specific question about that part of it, if you still need to. It's likely that most (maybe 95%) of your init file is irrelevant to the problem you are trying to ask about. It's your job to pare that down, in order to help others help you better. – Drew Dec 31 '17 at 1:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.