branch: externals/sly
commit 6d6e8fb174fd612772056fee6e970b0acc8c9bb9
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>

    Fix #370: Survive propertized strings read from minibuffer
    
    Extensions like 'ws-butler' will sometimes produce these.
    
    Reported by Pierre Neidhardt <[email protected]>.
    
    * sly.el (sly--sanitize-or-lose): New helper.
    (sly-net-send): Use it.
---
 sly.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sly.el b/sly.el
index f6be037..ebe8cc1 100644
--- a/sly.el
+++ b/sly.el
@@ -1585,12 +1585,24 @@ first line of the file."
 (defvar sly-net-send-translator nil
   "If non-nil, function to translate outgoing sexps for the wire.")
 
+(defun sly--sanitize-or-lose (form)
+  "Sanitize FORM for Slynk or error."
+  (cl-typecase form
+    (number)
+    (symbol 'fonix)
+    (string (set-text-properties 0 (length form) nil form))
+    (cons (sly--sanitize-or-lose (car form))
+          (sly--sanitize-or-lose (cdr form)))
+    (t (sly-error "Can't serialize %s for Slynk." form)))
+  form)
+
 (defun sly-net-send (sexp proc)
   "Send a SEXP to Lisp over the socket PROC.
 This is the lowest level of communication. The sexp will be READ and
 EVAL'd by Lisp."
   (let* ((print-circle nil)
          (print-quoted nil)
+         (sexp (sly--sanitize-or-lose sexp))
          (sexp (if (and sly-net-send-translator
                         (fboundp sly-net-send-translator))
                    (funcall sly-net-send-translator sexp)

Reply via email to