emacs-diffs
[Top][All Lists]
Advanced

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

scratch/jsonrpc-things 5465d88b635 1/2: Jsonrpc: allow methods identifie


From: João Távora
Subject: scratch/jsonrpc-things 5465d88b635 1/2: Jsonrpc: allow methods identifiers to be simply strings
Date: Sat, 2 Dec 2023 03:28:52 -0500 (EST)

branch: scratch/jsonrpc-things
commit 5465d88b635dd8070b7d7b04e7522bf7e83cd85b
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Jsonrpc: allow methods identifiers to be simply strings
    
    * lisp/jsonrpc.el (jsonrpc-connection-send): Support string methods.
---
 lisp/jsonrpc.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 849a8d8eaee..2036e135f52 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -443,7 +443,9 @@ connection object, called when the process dies.")
   (when method
     (plist-put args :method
                (cond ((keywordp method) (substring (symbol-name method) 1))
-                     ((and method (symbolp method)) (symbol-name method)))))
+                     ((symbolp method) (symbol-name method))
+                     ((stringp method) method)
+                     (t (error "[jsonrpc] invalid method %s" method)))))
   (let* ( (message `(:jsonrpc "2.0" ,@args))
           (json (jsonrpc--json-encode message))
           (headers



reply via email to

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