branch: externals/cape
commit b568f6c694cce547eb4ae615332d464c48e4be0e
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    Reset completion-regexp-list in cached table recomputation
    
    Resetting `completion-regexp-list' is necessary since the candidate 
computation
    could itself use `all-completions'. Ideally such usage of `all-completions'
    would rebind `completion-regexp-list' to nil itself, but it is safer to 
ensure
    this from outside.
---
 cape.el | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/cape.el b/cape.el
index 6461e4061b..0cb93c0abf 100644
--- a/cape.el
+++ b/cape.el
@@ -240,9 +240,13 @@ still valid."
           (when (or (not valid)
                     (not (or (string-match-p "\\s-" input) ;; Support Orderless
                              (funcall valid input))))
-            (pcase-let ((`(,new-valid . ,new-table) (funcall fun input))
-                        (throw-on-input nil)) ;; No interrupt during state 
update
-              (setq table new-table valid new-valid))))
+            (let* (;; Reset in case `all-completions' is used inside FUN
+                   completion-ignore-case completion-regexp-list
+                   ;; Retrieve new state by calling FUN
+                   (new (funcall fun input))
+                   ;; No interrupt during state update
+                   throw-on-input)
+              (setq valid (car new) table (cdr new)))))
         (complete-with-action action table str pred)))))
 
 ;;;; Capfs
@@ -855,7 +859,10 @@ completion table is refreshed on every input change."
             (let ((new-input (buffer-substring-no-properties beg end)))
               (unless (or (string-match-p "\\s-" new-input) ;; Support 
Orderless
                           (funcall valid input new-input))
-                (pcase (funcall capf)
+                (pcase
+                    ;; Reset in case `all-completions' is used inside CAPF
+                    (let (completion-ignore-case completion-regexp-list)
+                      (funcall capf))
                   (`(,_beg ,_end ,new-table . ,new-plist)
                    (let (throw-on-input) ;; No interrupt during state update
                      (setf table new-table

Reply via email to