diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2021-12-13 12:26:35 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2021-12-13 12:27:58 +0100 |
| commit | c1870977f6a9107cef59c482446fca60991dfd4b (patch) | |
| tree | 7b1020131c994207b3b0580d49e8f2f06fcb17ed | |
| parent | 76339f0dc31f3ce99dd66198e990b03f448de3de (diff) | |
Workaround for bug#50470: Fix misbehaving Capfs
- Ensure that Capfs do not manipulate the buffer
- Redirect illegal calls to completion-in-region
| -rw-r--r-- | corfu.el | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1153,7 +1153,19 @@ there hasn't been any input, then quit." (defun corfu--capf-wrapper (fun) "Wrapper for `completion-at-point' FUN. Determines if the capf is applicable at the current position." - (pcase (funcall fun) + (pcase + ;; bug#50470: Fix Capfs which illegally modify the buffer + ;; or which illegally call `completion-in-region' + (catch 'corfu--illegal-completion-in-region + (condition-case nil + (let ((buffer-read-only t) + (inhibit-read-only nil) + (completion-in-region-function + (lambda (beg end coll pred) + (throw 'corfu--illegal-completion-in-region + (list beg end coll :predicate pred))))) + (funcall fun)) + (buffer-read-only nil))) ((and res `(,beg ,end ,table . ,plist)) (and (integer-or-marker-p beg) ;; Valid capf result (<= beg (point) end) ;; Sanity checking |
