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

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

[elpa] externals/corfu 8f0b716: Fix completion cycling in eshell


From: ELPA Syncer
Subject: [elpa] externals/corfu 8f0b716: Fix completion cycling in eshell
Date: Fri, 6 Aug 2021 08:57:07 -0400 (EDT)

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

    Fix completion cycling in eshell
---
 corfu.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/corfu.el b/corfu.el
index 2439821..2a6c240 100644
--- a/corfu.el
+++ b/corfu.el
@@ -770,16 +770,17 @@ completion began less than that number of seconds ago."
 (defun corfu-complete ()
   "Try to complete current input."
   (interactive)
-  (if (>= corfu--index 0)
-      (corfu--insert nil) ;; Continue completion
-    (pcase-let* ((`(,beg ,end ,table ,pred) completion-in-region--data)
-                 (pt (max 0 (- (point) beg)))
-                 (str (buffer-substring-no-properties beg end))
-                 (metadata (completion-metadata (substring str 0 pt) table 
pred)))
-      (pcase (completion-try-completion str table pred pt metadata)
-        ((and `(,newstr . ,newpt) (guard (not (equal str newstr))))
-         (completion--replace beg end newstr)
-         (goto-char (+ beg newpt)))))))
+  (cond
+   (completion-cycling (completion-at-point)) ;; Proceed with cycling
+   ((>= corfu--index 0) (corfu--insert nil)) ;; Continue completion
+   (t (pcase-let* ((`(,beg ,end ,table ,pred) completion-in-region--data)
+                   (pt (max 0 (- (point) beg)))
+                   (str (buffer-substring-no-properties beg end))
+                   (metadata (completion-metadata (substring str 0 pt) table 
pred)))
+        (pcase (completion-try-completion str table pred pt metadata)
+          ((and `(,newstr . ,newpt) (guard (not (equal str newstr))))
+           (completion--replace beg end newstr)
+           (goto-char (+ beg newpt))))))))
 
 (defun corfu--insert (status)
   "Insert current candidate, exit with STATUS if non-nil."



reply via email to

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