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

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

[nongnu] elpa/mpv 9e1781249f 27/50: convert numbers to strings before en


From: ELPA Syncer
Subject: [nongnu] elpa/mpv 9e1781249f 27/50: convert numbers to strings before encoding as JSON
Date: Tue, 28 Dec 2021 00:58:42 -0500 (EST)

branch: elpa/mpv
commit 9e1781249fc362e1f095e4773dca25a840e4b7e2
Author: Johann Klähn <kljohann@gmail.com>
Commit: Johann Klähn <kljohann@gmail.com>

    convert numbers to strings before encoding as JSON
    
    Seems like mpv wants "command" to be a list of strings.
---
 mpv.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/mpv.el b/mpv.el
index 6b2c972db3..dbabfba262 100644
--- a/mpv.el
+++ b/mpv.el
@@ -119,6 +119,14 @@ prepended to ARGS."
     (run-hook-with-args 'mpv-on-start-hook args)
     t))
 
+(defun -as-strings (command)
+  "Convert COMMAND to a list of strings."
+  (mapcar (lambda (arg)
+            (if (numberp arg)
+                (number-to-string arg)
+              arg))
+          command))
+
 (defun -enqueue (command fn &optional delay-command)
   "Add COMMAND to the transaction queue.
 
@@ -133,7 +141,7 @@ below."
   (when (live-p)
     (tq-enqueue
      -queue
-     (concat (json-encode `((command . ,command))) "\n")
+     (concat (json-encode `((command . ,(-as-strings command)))) "\n")
      "" nil fn delay-command)
     t))
 



reply via email to

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