[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu fef546f221 3/3: corfu-auto: Ensure that buffer ti
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu fef546f221 3/3: corfu-auto: Ensure that buffer tick has not changed |
Date: |
Wed, 12 Jan 2022 15:57:21 -0500 (EST) |
branch: externals/corfu
commit fef546f221a690c09c67dcca1a1217d6e3215907
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
corfu-auto: Ensure that buffer tick has not changed
---
corfu.el | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/corfu.el b/corfu.el
index 6509c1f87c..b91ce05ed7 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1096,11 +1096,11 @@ there hasn't been any input, then quit."
(equal (completion-boundaries before table pred
after) '(0 . 0))))))
(corfu--setup)))))
-(defun corfu--auto-complete (buffer)
- "Initiate auto completion after delay in BUFFER."
+(defun corfu--auto-complete (buf tick pt)
+ "Initiate auto completion if BUF, TICK and PT did not change."
(setq corfu--auto-timer nil)
- (when (and (not completion-in-region-mode)
- (eq (current-buffer) buffer))
+ (when (and (not completion-in-region-mode) (eq buf (current-buffer))
+ (eq tick (buffer-chars-modified-tick)) (eq pt (point)))
(pcase (while-no-input ;; Interruptible capf query
(run-hook-wrapped 'completion-at-point-functions
#'corfu--capf-wrapper))
((and `(,fun ,beg ,end ,table . ,plist)
@@ -1131,9 +1131,10 @@ there hasn't been any input, then quit."
(display-graphic-p))
;; NOTE: Do not use idle timer since this leads to unacceptable slowdowns,
;; in particular if flyspell-mode is enabled.
- (setq corfu--auto-timer (run-at-time corfu-auto-delay nil
- #'corfu--auto-complete
- (current-buffer)))))
+ (setq corfu--auto-timer
+ (run-at-time
+ corfu-auto-delay nil #'corfu--auto-complete
+ (current-buffer) (buffer-chars-modified-tick) (point)))))
;;;###autoload
(define-minor-mode corfu-mode