From 888b4525361c4050f35f4766fe7651c97d3274ce Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 25 Feb 2024 17:44:46 +0100 Subject: consult--async-throttle: Better computation of the throttle delay --- consult.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/consult.el b/consult.el index 7d9aee4..a4caafb 100644 --- a/consult.el +++ b/consult.el @@ -2302,7 +2302,7 @@ The THROTTLE delay defaults to `consult-async-input-throttle'. The DEBOUNCE delay defaults to `consult-async-input-debounce'." (setq throttle (or throttle consult-async-input-throttle) debounce (or debounce consult-async-input-debounce)) - (let* ((input "") (timer (timer-create)) last) + (let* ((input "") (timer (timer-create)) (last 0)) (lambda (action) (pcase action ((pred stringp) @@ -2317,7 +2317,7 @@ The DEBOUNCE delay defaults to `consult-async-input-debounce'." (timer-set-time timer (timer-relative-time - nil (max debounce (if last (min (- (float-time) last) throttle) 0)))) + nil (max debounce (- (+ last throttle) (float-time))))) (timer-activate timer))) nil) ('destroy -- cgit v1.2.3