branch: externals/minuet commit 8b9ea6ff1cb05840bee7daf31a95d4a3ad105537 Author: Milan Glacier <d...@milanglacier.com> Commit: Milan Glacier <d...@milanglacier.com>
fix: use idle timer and fix buffer changing check for auto-suggestion. --- minuet.el | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/minuet.el b/minuet.el index 9d6e79a0f9..79253c578d 100644 --- a/minuet.el +++ b/minuet.el @@ -988,16 +988,17 @@ to be called when completion items arrive." (when minuet--debounce-timer (cancel-timer minuet--debounce-timer)) (setq minuet--debounce-timer - (run-with-timer - minuet-auto-suggestion-debounce-delay nil - (lambda () - (when (and (eq (window-buffer (selected-window)) (current-buffer)) - (or (null minuet--auto-last-point) - (not (eq minuet--auto-last-point (point)))) - (not (run-hook-with-args-until-success 'minuet-auto-suggestion-block-functions))) - (setq minuet--last-auto-suggestion-time (current-time) - minuet--auto-last-point (point)) - (minuet-show-suggestion))))))) + (let ((buffer (current-buffer))) + (run-with-idle-timer + minuet-auto-suggestion-debounce-delay nil + (lambda () + (when (and (eq buffer (current-buffer)) + (or (null minuet--auto-last-point) + (not (eq minuet--auto-last-point (point)))) + (not (run-hook-with-args-until-success 'minuet-auto-suggestion-block-functions))) + (setq minuet--last-auto-suggestion-time (current-time) + minuet--auto-last-point (point)) + (minuet-show-suggestion)))))))) (defun minuet--cleanup-auto-suggestion () "Clean up auto-suggestion timers and hooks."