branch: externals/capf-autosuggest
commit 84bdbc5f0809c26bc8d527abaf79bcec85cdecb5
Author: jakanakaevangeli <[email protected]>
Commit: jakanakaevangeli <[email protected]>

    Fix completion-in-region popping up in eshell after "(forward"
---
 capf-autosuggest.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index bbc3e7e..9ba92ca 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -169,9 +169,18 @@ Otherwise, return nil."
         (capf-autosuggest-active-mode -1))))
 
   (unless capf-autosuggest-active-mode
-    (pcase (let ((buffer-read-only t))
+    (pcase (let* ((catch-sym (make-symbol "cirf-catch"))
+                  ;; `pcomplete-completions-at-point' may illegally use
+                  ;; `completion-in-region' itself instead of returning a
+                  ;; collection.  Let's try to outsmart it.
+                  (completion-in-region-function
+                   (lambda (start end collection predicate)
+                     (throw catch-sym
+                            (list start end collection :predicate predicate))))
+                  (buffer-read-only t))
              (condition-case _
-                 (capf-autosuggest-orig-capf 'capf-autosuggest-capf-functions)
+                 (catch catch-sym
+                   (capf-autosuggest-orig-capf 
'capf-autosuggest-capf-functions))
                (buffer-read-only t)))
       (`(,beg ,end ,table . ,plist)
        (let* ((pred (plist-get plist :predicate))

Reply via email to