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

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

[nongnu] externals/sly 6d6e8fb 5/7: Fix #370: Survive propertized string


From: Stefan Monnier
Subject: [nongnu] externals/sly 6d6e8fb 5/7: Fix #370: Survive propertized strings read from minibuffer
Date: Sat, 21 Nov 2020 01:34:52 -0500 (EST)

branch: externals/sly
commit 6d6e8fb174fd612772056fee6e970b0acc8c9bb9
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Fix #370: Survive propertized strings read from minibuffer
    
    Extensions like 'ws-butler' will sometimes produce these.
    
    Reported by Pierre Neidhardt <mail@ambrevar.xyz>.
    
    * 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

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