branch: externals/capf-autosuggest
commit b836fccf22543cd73a2037d897de3b2216ef4e0f
Author: jakanakaevangeli <[email protected]>
Commit: jakanakaevangeli <[email protected]>
Prevent misbehaving capf functions from modifying buffer
Fixes the following bug:
1) M-x eshell RET
2) M-x capf-autosuggest-mode RET
3) bash RET
4) e
A misbehaving capf function will insert TAB
---
capf-autosuggest.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index 21f0544..104bdf2 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -160,7 +160,10 @@ Otherwise, return nil."
(capf-autosuggest-active-mode -1))))
(unless capf-autosuggest-active-mode
- (pcase (capf-autosuggest-orig-capf 'capf-autosuggest-capf-functions)
+ (pcase (let ((buffer-read-only t))
+ (condition-case _
+ (capf-autosuggest-orig-capf 'capf-autosuggest-capf-functions)
+ (buffer-read-only t)))
(`(,beg ,end ,table . ,plist)
(let* ((pred (plist-get plist :predicate))
(string (buffer-substring-no-properties beg end))