* bug#27622: Trying to improve the speed of linum-mode
@ 2017-07-08 9:25 Fis Trivial
2017-07-08 17:01 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: Fis Trivial @ 2017-07-08 9:25 UTC (permalink / raw)
To: 27622
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?
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#27622: Trying to improve the speed of linum-mode
2017-07-08 9:25 bug#27622: Trying to improve the speed of linum-mode Fis Trivial
@ 2017-07-08 17:01 ` Eli Zaretskii
[not found] ` <BN6PR16MB1859AD697302D7AD9BCFE79D92AB0@BN6PR16MB1859.namprd16.prod.outlook.com>
2017-07-09 23:29 ` Glenn Morris
0 siblings, 2 replies; 11+ messages in thread
From: Eli Zaretskii @ 2017-07-08 17:01 UTC (permalink / raw)
To: Fis Trivial; +Cc: 27622
> From: Fis Trivial <ybbs.daans@hotmail.com>
> 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:
Thanks.
Recently, the development sources were updated to provide line-number
display built into Emacs. That facility doesn't count lines in the
whole buffer, so the slow-down you mention doesn't happen.
So I see no reason to try to fix this issue in linum-mode.
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <BN6PR16MB1859AD697302D7AD9BCFE79D92AB0@BN6PR16MB1859.namprd16.prod.outlook.com>]
* bug#27622: Trying to improve the speed of linum-mode
2017-07-08 17:01 ` Eli Zaretskii
[not found] ` <BN6PR16MB1859AD697302D7AD9BCFE79D92AB0@BN6PR16MB1859.namprd16.prod.outlook.com>
@ 2017-07-09 23:29 ` Glenn Morris
2017-07-10 16:50 ` Eli Zaretskii
1 sibling, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2017-07-09 23:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 27622, Fis Trivial
Time to obsolete linum.el (which now has two replacements)?
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#27622: Trying to improve the speed of linum-mode
2017-07-09 23:29 ` Glenn Morris
@ 2017-07-10 16:50 ` Eli Zaretskii
2017-07-31 2:06 ` Glenn Morris
0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2017-07-10 16:50 UTC (permalink / raw)
To: Glenn Morris; +Cc: 27622, ybbs.daans
> From: Glenn Morris <rgm@gnu.org>
> Cc: Fis Trivial <ybbs.daans@hotmail.com>, 27622@debbugs.gnu.org
> Date: Sun, 09 Jul 2017 19:29:11 -0400
>
>
> Time to obsolete linum.el (which now has two replacements)?
Probably. But do we move it to obsolete right away, or just mark its
main entry "obsolete"?
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#27622: Trying to improve the speed of linum-mode
2017-07-10 16:50 ` Eli Zaretskii
@ 2017-07-31 2:06 ` Glenn Morris
2017-07-31 3:11 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2017-07-31 2:06 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 27622, ybbs.daans
Eli Zaretskii wrote:
>> Time to obsolete linum.el (which now has two replacements)?
>
> Probably. But do we move it to obsolete right away, or just mark its
> main entry "obsolete"?
I would move it to obsolete, but add a manual autoload so that M-x
linum-mode still works. Cf iswitchb-mode in icomplete.el.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#27622: Trying to improve the speed of linum-mode
2017-07-31 2:06 ` Glenn Morris
@ 2017-07-31 3:11 ` Eli Zaretskii
0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2017-07-31 3:11 UTC (permalink / raw)
To: Glenn Morris; +Cc: 27622, ybbs.daans
> From: Glenn Morris <rgm@gnu.org>
> Cc: ybbs.daans@hotmail.com, 27622@debbugs.gnu.org
> Date: Sun, 30 Jul 2017 22:06:31 -0400
>
> Eli Zaretskii wrote:
>
> >> Time to obsolete linum.el (which now has two replacements)?
> >
> > Probably. But do we move it to obsolete right away, or just mark its
> > main entry "obsolete"?
>
> I would move it to obsolete, but add a manual autoload so that M-x
> linum-mode still works. Cf iswitchb-mode in icomplete.el.
Fine with me, thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-07-31 3:11 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-08 9:25 bug#27622: Trying to improve the speed of linum-mode Fis Trivial
2017-07-08 17:01 ` Eli Zaretskii
[not found] ` <BN6PR16MB1859AD697302D7AD9BCFE79D92AB0@BN6PR16MB1859.namprd16.prod.outlook.com>
2017-07-08 18:55 ` Eli Zaretskii
[not found] ` <BN6PR16MB1859941C3153757777556D4192AB0@BN6PR16MB1859.namprd16.prod.outlook.com>
2017-07-08 19:44 ` Eli Zaretskii
[not found] ` <BN6PR16MB185932C3CF6DFA06F47DAA8A92AB0@BN6PR16MB1859.namprd16.prod.outlook.com>
2017-07-09 14:39 ` Eli Zaretskii
2017-07-09 18:06 ` Fis Trivial
2017-07-09 18:27 ` Eli Zaretskii
2017-07-09 23:29 ` Glenn Morris
2017-07-10 16:50 ` Eli Zaretskii
2017-07-31 2:06 ` Glenn Morris
2017-07-31 3:11 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.