[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 3756017533: corfu--completion-in-region: Rework c
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu 3756017533: corfu--completion-in-region: Rework completion termination |
Date: |
Wed, 19 Jan 2022 19:57:24 -0500 (EST) |
branch: externals/corfu
commit 3756017533b5f42681366e19d81b837c77156b92
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
corfu--completion-in-region: Rework completion termination
corfu--completion-in-region should be replaced with a clean
reimplementation of
the default completion and cycling behavior.
---
corfu.el | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/corfu.el b/corfu.el
index 7c75fcbd28..39dae84457 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1066,6 +1066,10 @@ there hasn't been any input, then quit."
(completion--cache-all-sorted-completions
beg end (nconc all base))))))
+;; TODO Rewrite this with a clean reimplementation. We have to use way
+;; too many advices and overrides to adjust default completion to our
+;; needs. The original idea was to initiate completion via
+;; `completion--in-region' and proceed with the Corfu popup.
(defun corfu--completion-in-region (&rest args)
"Corfu completion in region function passing ARGS to
`completion--in-region'."
(barf-if-buffer-read-only)
@@ -1082,6 +1086,14 @@ there hasn't been any input, then quit."
;; Set the predicate to ensure that
`completion-in-region-mode' is enabled.
(completion-in-region-mode-predicate
(or completion-in-region-mode-predicate (lambda () t)))
+ ;; Disable completion-in-region-mode after exit!
+ (exit-fun (plist-get completion-extra-properties
:exit-function))
+ (completion-extra-properties
+ `(:exit-function
+ ,(lambda (str status)
+ (when exit-fun (funcall exit-fun str status))
+ (when (eq status 'finished)
(completion-in-region-mode -1)))
+ ,@completion-extra-properties))
;; Overwrite to avoid hanging.
((symbol-function #'completion--message)
#'corfu--completion-message)
@@ -1090,11 +1102,6 @@ there hasn't been any input, then quit."
#'corfu--all-sorted-completions))
(apply #'completion--in-region args))
(when (and completion-in-region-mode
- ;; Terminate immediately when the completion boundary changed.
- ;; This happens for example when completing file names in
shell
- ;; and the terminating space is added by the :exit-function.
- (or (funcall completion-in-region-mode--predicate)
- (and (completion-in-region-mode -1) nil))
;; Do not show Corfu when "trivially" cycling, i.e.,
;; when the completion is finished after the candidate.
(not (and completion-cycling
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/corfu 3756017533: corfu--completion-in-region: Rework completion termination,
ELPA Syncer <=