51.9 Long Lines
For a variety of reasons (some of which are fundamental to the Emacs redisplay code and the complex range of possibilities it handles; others of which are due to modes and features which do not scale well in unusual circumstances), Emacs can perform poorly when extremely long lines are present (where “extremely long" usually means at least many thousands of characters).
A particular problem is that Emacs may “hang" for a long time at the point of visiting a file with extremely long lines. This can be mitigated by enabling the so-long
library, which detects when a visited file contains abnormally long lines, and takes steps to disable features which are liable to cause slowness in that situation. To enable this library, type M-x global-so-long-mode RET
, or turn on the global-so-long-mode
in your init file (see Init File), or customize the global-so-long-mode
option. You can tailor this mode’s operation by customizing the variable so-long-action
.
The so-long
library can also significantly improve performance when moving and editing in a buffer with long lines. Performance is still likely to degrade as you get deeper into the long lines, but the improvements from using this library can nevertheless be substantial.
Use M-x so-long-commentary
to view the documentation for this library and learn more about how to enable and configure it.