I really like the package sml-modeline (it is available on melpa): https://melpa.org/#/sml-modeline With it I replaced my vertical scrollbars.
But when opening large text files like this Raspbian-Package-List (warning: 38MB download) then Emacs gets realy slow. Disabling sml-modeline-mode
instantly speeds up emacs.
So I had a look at sml-modelines source code. In function sml-modeline-create
there is a call to widen
and point-max
, which I suspect to make sml-modeline-mode
so slow (*1*).
If (*1*) is the case, is it possible to store those values in between calls of sml-modeline-create
to speed things up, and how do it? I think those values need to be stored for every single buffer, or every time a call to switch-to-buffer is done.
If (*1*) is not the case, what operations make sml-modeline-mode
so slow and how to speed this up?
This Package did not get an update since January 2012, so maybe it is already abandoned. :-(
line-number-at-pos
that is called in a few places. For a fix/workaround, see this related thread entitled "A faster method to obtainline-number-at-pos
in large buffers": emacs.stackexchange.com/questions/3821/… You may also wish to tell the author about this problem and workaround/fix. Essentially, you can use(save-excursion (goto-char ...))
with the answer by Constantine in the related thread.(setq number-max (line-number-at-pos (point-max))) (setq number-beg (line-number-at-pos wstart)) (setq number-end (line-number-at-pos wend)))
with(save-excursion (goto-char (point-max)) (setq number-max (string-to-number (format-mode-line "%l"))) (goto-char wstart) (setq number-beg (string-to-number (format-mode-line "%l"))) (goto-char wstart) (setq number-end (string-to-number (format-mode-line "%l")))))
if you write a answer I will accept it. Thank you!