syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.9k forks source link

Searching with `/` on a large file freezes Emacs at the first character input #9887

Closed x-ji closed 4 years ago

x-ji commented 6 years ago

Description :octocat:

Emacs hangs at the first character input when searching with / on a large file

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: When the first character input is received by Emacs, it hangs for a long while, sometimes more than 10 seconds, before finally proceeding to accept the whole search term and display it in the document.

Expected behaviour: :heart: :smile: Emacs proceeds to search for this term normally without delay

System Info :computer:

Backtrace :paw_prints:

x-ji commented 6 years ago

I have a hunch that this has something to do with the fact that Emacs tries to highlight all matches in the current buffer. However, since a search term with only one character is bound to occur for extremely many times in a large file, this highlighting freezes Emacs. Maybe if I set Emacs to only highlight matching terms when it's several characters long, this problem would be solved?

x-ji commented 6 years ago

I looked at previous issues https://github.com/syl20bnr/spacemacs/issues/9410, https://github.com/syl20bnr/spacemacs/issues/9220 and https://github.com/TheBB/spaceline/issues/123#issuecomment-304696321, but I'm pretty sure this is unrelated since I don't even use spaceline. I use vim-powerline.

sdwolfz commented 6 years ago

Try using the documentation from here to debug it: https://github.com/syl20bnr/spacemacs/wiki/Debugging#debug-a-freezing-instance.

eggsyntax commented 6 years ago

Just chiming in to say I'm encountering this as well on develop (but just switched back to master, so we'll see). My intuition matches @x-ji 's, although it's just a guess.

syl20bnr commented 6 years ago

Duplicate of https://github.com/syl20bnr/spacemacs/issues/9220

BryceStevenWilley commented 5 years ago

Following @sdwolfz's link on how to debug I get this output (running on devel, commit 6b03fefe17ff3ccdadd10cad81cccf525a5f4f19):

Debugger entered--Lisp error: (quit)
  redisplay_internal\ \(C\ function\)()
  read-string("/" #("Custom" 0 6 (face shadow)) evil-ex-search-history)
  evil-ex-start-search(forward nil)
  evil-ex-search-forward(nil)
  funcall-interactively(evil-ex-search-forward nil)
  call-interactively(evil-ex-search-forward nil nil)
  command-execute(evil-ex-search-forward)
github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!