10

I'm using the package Multiple Cursors in an html file and it's awesome for a few cursors but if I create more than 30 or 50 cursors it gets terribly slow and it takes about five or six seconds just to move the cursors.
Am I using it wrong or it just that it's not prepared for creating that many cursors?.

3
  • 2
    It depends on what's going on in the buffer -- some buffers are just more difficult for Magnar's multiple-cursors. Sometimes I can have a few hundred without a significant slowdown, and sometimes just a few in (let's say wdired-mode) causes slowdown. There is an open feature request -- debbugs.gnu.org/cgi/bugreport.cgi?bug=22873 -- to move multiple cursor capabilities into the C source code, but it's still an ongoing discussion at the moment. One of my proposed selling points to the Emacs development team was a potential increase in speed if it were baked into the C code base.
    – lawlist
    Mar 15, 2016 at 22:14
  • 3
    I don't have a solution but wanted to confirm the same slowness for me as well. I wouldn't be surprised if the problem is traced to font-lock issues. When I tun off font lock globally, the cursors become snappy again.
    – Emacs User
    Mar 15, 2016 at 22:17
  • 1
    ...in which case multiple-cursors wouldn't be causing the slow-downs directly (even if the slowness only turns out to be a factor when you're using it). I would M-x profiler-start and do a bunch of slow things and then M-x profiler-report, and keep drilling down into the item(s) taking up the majority of the CPU time until you can isolate it to some particular library (if any); then try disabling that library. Don't forget to stop the profiler when you're finished with it.
    – phils
    Jun 14, 2016 at 0:41

2 Answers 2

4

A list of minor modes that do not play well with multiple cursors mode can be set via mc/unsupported-minor-modes. Any modes added to this list will be disabled when entering multiple cursors mode, they will be re-enabled once you drop out of multiple cursors mode.

You can add an item to this list like so

(add-to-list 'mc/unsupported-minor-modes 'flyspell-mode)

This makes a big difference to the responsiveness of multiple cursors mode. I found the two minor modes having the biggest impact were linum mode and flyspell.

5
  • If someone could try and explain why flyspell makes things slow (or give a concise recipe to reproduce the slowness with flyspell), maybe we could try and fix the problem.
    – Stefan
    Dec 5, 2017 at 22:57
  • 1
    I have tried to profile the slowness, but have not been able to find any consistent pattern. That being said the slowness introduced by flyspell is not too bad, the module I find by far worse is linum mode. Turning off linum mode allowed me to go from 30 cursors at a time to over 600. Dec 6, 2017 at 1:08
  • A reproducible recipe would go a long way.
    – Stefan
    Dec 6, 2017 at 1:28
  • 1
    Thank you for the help!. it seems that this was the problem. Indent-guide-mode and Linum-mode where the ones that I have to disable ( I disabled indent-guide and replaced Linum with nlinum ). Now I'm able to have hundreds of cursors without any lag.
    – Fabman
    Feb 20, 2018 at 10:59
  • Thanks, same here! My problem was also line numbers mode (on doom emacs) Feb 5, 2021 at 7:42
-1

... more than 30 or 50 cursors it gets terribly slow ....

Here's a temp solution: adjust this variable

mc/max-cursors

to a value less than 30 as a workaround. The default is nil, which means no limit. The actual number to restore the speed depends on the buffer type, fonts used, and whatever else is running at the time. In any case, the problem you are having has been widely reported.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.