emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/corfu 641ea48462: Introduce `corfu--auto-tick' which ca


From: ELPA Syncer
Subject: [elpa] externals/corfu 641ea48462: Introduce `corfu--auto-tick' which captures the buffer tick/status (Fix #107)
Date: Sat, 22 Jan 2022 17:57:25 -0500 (EST)

branch: externals/corfu
commit 641ea484628f12aa56515792ce4f9012c2e23b1c
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Introduce `corfu--auto-tick' which captures the buffer tick/status (Fix 
#107)
    
    If Corfu is used in conjunction with multiple-cursors one has
    to overwrite `corfu--auto-tick', such that it captures less information.
---
 corfu.el | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/corfu.el b/corfu.el
index a0b07b3027..10516a4e80 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1119,11 +1119,10 @@ See `completion-in-region' for the arguments BEG, END, 
TABLE, PRED."
     (define-key map (vector last-command-event) replace)
     (funcall replace)))
 
-(defun corfu--auto-complete (buf tick pt)
-  "Initiate auto completion if BUF, TICK and PT did not change."
+(defun corfu--auto-complete (tick)
+  "Initiate auto completion if TICK did not change."
   (setq corfu--auto-timer nil)
-  (when (and (not completion-in-region-mode) (eq buf (current-buffer))
-             (eq tick (buffer-chars-modified-tick)) (eq pt (point)))
+  (when (and (not completion-in-region-mode) (equal tick (corfu--auto-tick)))
     (pcase (while-no-input ;; Interruptible capf query
              (run-hook-wrapped 'completion-at-point-functions 
#'corfu--capf-wrapper))
       ((and `(,fun ,beg ,end ,table . ,plist)
@@ -1154,9 +1153,13 @@ See `completion-in-region' for the arguments BEG, END, 
TABLE, PRED."
     ;; 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) (buffer-chars-modified-tick) (point)))))
+          (run-at-time corfu-auto-delay nil
+                       #'corfu--auto-complete (corfu--auto-tick)))))
+
+(defun corfu--auto-tick ()
+  "Return the current tick/status of the buffer.
+Auto completion is only performed if the tick did not change."
+  (list (current-buffer) (buffer-chars-modified-tick) (point)))
 
 ;;;###autoload
 (define-minor-mode corfu-mode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]