Function: cape-wrap-buster
cape-wrap-buster is an autoloaded and byte-compiled function defined
in cape.el.
Signature
(cape-wrap-buster CAPF &optional VALID)
Documentation
Call CAPF and return a completion table with cache busting.
This function can be used as an advice around an existing Capf.
The cache is busted when the input changes. The argument VALID
can be a function taking the old and new input string. It should
return nil if the new input requires that the completion table is
refreshed. The default value for VALID is equal, such that the
completion table is refreshed on every input change.
Source Code
;; Defined in ~/.emacs.d/elpa/cape-20260804.2303/cape.el
;;;###autoload
(defun cape-wrap-buster (capf &optional valid)
"Call CAPF and return a completion table with cache busting.
This function can be used as an advice around an existing Capf.
The cache is busted when the input changes. The argument VALID
can be a function taking the old and new input string. It should
return nil if the new input requires that the completion table is
refreshed. The default value for VALID is `equal', such that the
completion table is refreshed on every input change."
(setq valid (or valid #'equal))
(pcase (funcall capf)
(`(,beg ,end ,table . ,plist)
(setq plist `(:cape--buster t . ,plist))
`( ,beg ,end
,(let* ((beg (copy-marker beg))
(end (copy-marker end t))
(input (buffer-substring-no-properties beg end)))
(lambda (str pred action)
(let ((new-input (buffer-substring-no-properties beg end)))
(unless (or (not (eq action t))
(cape--separator-p new-input)
(funcall valid input new-input))
(pcase
;; Reset in case `all-completions' is used inside CAPF
(let (completion-ignore-case completion-regexp-list)
(funcall capf))
((and `(,new-beg ,new-end ,new-table . ,new-plist)
(guard (and (= beg new-beg) (= end new-end))))
(let (throw-on-input) ;; No interrupt during state update
(setf table new-table
input new-input
(cddr plist) new-plist))))))
(complete-with-action action table str pred)))
,@plist))))