* bug#16545: 24.3.50; Patch to coalesce calls to linum-update-current
@ 2014-01-25 7:57 Chow Loong Jin
2014-01-26 1:18 ` Glenn Morris
2019-06-26 14:49 ` Lars Ingebrigtsen
0 siblings, 2 replies; 6+ messages in thread
From: Chow Loong Jin @ 2014-01-25 7:57 UTC (permalink / raw)
To: 16545
[-- Attachment #1.1: Type: text/plain, Size: 479 bytes --]
When navigating using C-n/C-p with a high key repeat rate, causing
linum-schedule to be called many times in quick succession,
linum-update-current gets called as many times in linum-schedule,
eventhough one call per round should be enough to renumber the lines.
This patch adds a linum-delay-seconds option defaulting to 10ms to delay
the call to linum-update-current, thus coalescing all calls to
linum-update-current until Emacs settles for 10ms.
--
Kind regards,
Loong Jin
[-- Attachment #1.2: 0001-Add-customization-option-to-delay-linum-updates.patch --]
[-- Type: text/x-diff, Size: 1999 bytes --]
From 13a9fde7a9b0a4f7a40e6d5e9ce3447bbfed777b Mon Sep 17 00:00:00 2001
From: Chow Loong Jin <hyperair@debian.org>
Date: Fri, 24 Jan 2014 09:47:19 +0800
Subject: [PATCH] Add customization option to delay linum updates
When linum-schedule is called many times in quick succession, delay
the update by linum-delay-seconds, and coalesce all calls to
linum-update-current to avoid useless repeated calls.
Signed-off-by: Chow Loong Jin <hyperair@debian.org>
---
lisp/linum.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lisp/linum.el b/lisp/linum.el
index d91ce11..50759b5 100644
--- a/lisp/linum.el
+++ b/lisp/linum.el
@@ -37,6 +37,7 @@
(defvar linum-available nil "Overlays available for reuse.")
(defvar linum-before-numbering-hook nil
"Functions run in each buffer before line numbering starts.")
+(defvar linum-timer-object nil "Timer object for use with ilnum-delay")
(mapc #'make-variable-buffer-local '(linum-overlays linum-available))
@@ -71,6 +72,10 @@ and you have to scroll or press \\[recenter-top-bottom] to update the numbers."
"Delay updates to give Emacs a chance for other changes."
:group 'linum
:type 'boolean)
+(defcustom linum-delay-seconds 0.01
+ "Number of seconds to delay before running linum-update-window"
+ :group 'linum
+ :type 'floatp)
;;;###autoload
(define-minor-mode linum-mode
@@ -195,7 +200,12 @@ Linum mode is a buffer-local minor mode."
(defun linum-schedule ()
;; schedule an update; the delay gives Emacs a chance for display changes
- (run-with-idle-timer 0 nil #'linum-update-current))
+ (if linum-timer-object
+ (cancel-timer linum-timer-object))
+ (setq linum-timer-object
+ (run-with-timer linum-delay-seconds
+ nil
+ #'linum-update-current)))
;; (defun linum-after-config ()
;; (walk-windows (lambda (w) (linum-update (window-buffer w))) nil 'visible))
--
1.8.3.2
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#16545: 24.3.50; Patch to coalesce calls to linum-update-current
2014-01-25 7:57 bug#16545: 24.3.50; Patch to coalesce calls to linum-update-current Chow Loong Jin
@ 2014-01-26 1:18 ` Glenn Morris
2014-01-27 4:40 ` Chow Loong Jin
2019-06-26 14:49 ` Lars Ingebrigtsen
1 sibling, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2014-01-26 1:18 UTC (permalink / raw)
To: Chow Loong Jin; +Cc: 16545
Thanks for the patch.
The usual answer to anything involving linum.el is to try nlinum.el from
GNU ELPA instead (it's hoped this will replace linum.el one day).
Does nlinum.el have the same issue?
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#16545: 24.3.50; Patch to coalesce calls to linum-update-current
2014-01-26 1:18 ` Glenn Morris
@ 2014-01-27 4:40 ` Chow Loong Jin
2014-01-27 14:29 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Chow Loong Jin @ 2014-01-27 4:40 UTC (permalink / raw)
To: Glenn Morris; +Cc: 16545
[-- Attachment #1: Type: text/plain, Size: 830 bytes --]
On Sat, Jan 25, 2014 at 08:18:57PM -0500, Glenn Morris wrote:
>
> Thanks for the patch.
> The usual answer to anything involving linum.el is to try nlinum.el from
> GNU ELPA instead (it's hoped this will replace linum.el one day).
> Does nlinum.el have the same issue?
Not sure, I was only able to reproduce the issue when using linum-relative.el,
as that made the linum updates slower, and I've since upgraded my machine.
Looking at the source of nlinum.el, though, it doesn't delay the updates like
linum.el does, so updates to the line numbering is unlikely to lag. Instead, it
just makes the entire Emacs instance lag.
P.S. I hope nlinum.el in its current state does not replace linum.el -- neither
global-nlinum-mode nor nlinum-relative seem to exist for this just yet.
--
Kind regards,
Loong Jin
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#16545: 24.3.50; Patch to coalesce calls to linum-update-current
2014-01-27 4:40 ` Chow Loong Jin
@ 2014-01-27 14:29 ` Stefan Monnier
2014-01-28 3:13 ` Chow Loong Jin
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2014-01-27 14:29 UTC (permalink / raw)
To: Chow Loong Jin; +Cc: 16545
> P.S. I hope nlinum.el in its current state does not replace
> linum.el -- neither global-nlinum-mode nor nlinum-relative seem to
> exist for this just yet.
nlinum.el in the `elpa' branch does include global-nlinum-mode (it was
trivial to define).
But indeed there's no nlinum-relative. Not sure how best to implement it.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#16545: 24.3.50; Patch to coalesce calls to linum-update-current
2014-01-25 7:57 bug#16545: 24.3.50; Patch to coalesce calls to linum-update-current Chow Loong Jin
2014-01-26 1:18 ` Glenn Morris
@ 2019-06-26 14:49 ` Lars Ingebrigtsen
1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-26 14:49 UTC (permalink / raw)
To: Chow Loong Jin; +Cc: 16545
Chow Loong Jin <hyperair@debian.org> writes:
> When navigating using C-n/C-p with a high key repeat rate, causing
> linum-schedule to be called many times in quick succession,
> linum-update-current gets called as many times in linum-schedule,
> eventhough one call per round should be enough to renumber the lines.
>
> This patch adds a linum-delay-seconds option defaulting to 10ms to delay
> the call to linum-update-current, thus coalescing all calls to
> linum-update-current until Emacs settles for 10ms.
This was five years ago, and in the meantime, Emacs has gotten native
line number support, so I don't think this is applicable any more, and
I'm closing this bug report. If I've misunderstood, please reopen.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-26 14:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-25 7:57 bug#16545: 24.3.50; Patch to coalesce calls to linum-update-current Chow Loong Jin
2014-01-26 1:18 ` Glenn Morris
2014-01-27 4:40 ` Chow Loong Jin
2014-01-27 14:29 ` Stefan Monnier
2014-01-28 3:13 ` Chow Loong Jin
2019-06-26 14:49 ` Lars Ingebrigtsen
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.