emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/capf-autosuggest b836fcc 33/63: Prevent misbehaving cap


From: ELPA Syncer
Subject: [elpa] externals/capf-autosuggest b836fcc 33/63: Prevent misbehaving capf functions from modifying buffer
Date: Wed, 27 Oct 2021 14:57:59 -0400 (EDT)

branch: externals/capf-autosuggest
commit b836fccf22543cd73a2037d897de3b2216ef4e0f
Author: jakanakaevangeli <jakanakaevangeli@chiru.no>
Commit: jakanakaevangeli <jakanakaevangeli@chiru.no>

    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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]