emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#27622: closed (Trying to improve the speed of linu


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#27622: closed (Trying to improve the speed of linum-mode)
Date: Sun, 09 Jul 2017 18:28:02 +0000

Your message dated Sun, 09 Jul 2017 21:27:25 +0300
with message-id <address@hidden>
and subject line Re: bug#27622: Trying to improve the speed of linum-mode
has caused the debbugs.gnu.org bug report #27622,
regarding Trying to improve the speed of linum-mode
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
27622: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27622
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Trying to improve the speed of linum-mode Date: Sat, 8 Jul 2017 09:25:38 +0000
For some reasons, the linum-mode needs to go over the whole buffer in
order to update the line numbers. It's ok when viewing a small buffer,
but when comes to something large it will slow the emacs down like I
was viewing a ppt(try kernel patch). I don't really understand the
code, but I changed it a little bit and it works fine so far. Here is
the patch, linum-o.el is the original code:




--- linum-o.el  2017-06-06 09:04:32.012568000 +0800
+++ linum.el    2017-07-
08 16:45:45.710518928 +0800
@@ -174,7 +174,7 @@
         (fmt (cond
((stringp linum-format) linum-format)
                    ((eq linum-
format 'dynamic)
                     (let ((w (length (number-to-string

-                                      (count-lines (point-min) (point-
max))))))
+                                      (count-lines (window-
start win) (window-end win t))))))
                       (concat "%"
(number-to-string w) "d")))))
         (width 0))
     (run-hooks 'linum-
before-numbering-hook)




The minor change replaced (point-min/max) to (window-start/end) which
saves a lots of iterations and did improve the speed at start-up. but
if I move the cursor to the end of the buffer, it slows down again and
I don't know why it's happening.
So, I got wonder is there any particular reason to use (point-min)
instead of (window-start)? And what's the cause of slowing down when I
move the cursor to the end of buffer?

--- End Message ---
--- Begin Message --- Subject: Re: bug#27622: Trying to improve the speed of linum-mode Date: Sun, 09 Jul 2017 21:27:25 +0300
> From: Fis Trivial <address@hidden>
> CC: "address@hidden" <address@hidden>
> Date: Sun, 9 Jul 2017 18:06:18 +0000
> 
> It's great. Now the Emacs works perfectly. Thanks for your work.

Thanks, closing.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]