When working on huge files, it seems that when hide-show collapses a large multi-line block, linum still creates hidden overlays for every line in the hidden block leading to unresponsive emacs. Is there a way to fix linum?

To reproduce: Create a new file, enable c-mode, hs-minor-mode and linum-mode, create a huge block by typing: { C-u 10000 RET } then execute hs-hide-all and watch Emacs become unresponsive.

  • 1
    Try the nlinum package from GNU ELPA. Does that work better for you?
    – phils
    Feb 8 '17 at 17:58
  • Yes, there is a way to fix linum.el, but nobody really cares (except me). For starters, it can be restricted to only the visible window -- requiring a modification of the C source code to be efficient so that window-start and window-end values are always accurate [ debbugs.gnu.org/cgi/bugreport.cgi?bug=22404 ]. Second, the line-number-at-pos can be replaced with (format-mode-line "%l") [with some exceptions emacs.stackexchange.com/questions/3821/… ]. Third, it can be written to exclude invisible lines.
    – lawlist
    Feb 8 '17 at 18:54
  • 1
    Yes! nlinum seems to do the trick.
    – Tohiko
    Feb 9 '17 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.