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

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

[nongnu] elpa/xml-rpc 4fd5a03a36 36/64: xml-rpc.el: fix up callbacks for


From: Stefan Kangas
Subject: [nongnu] elpa/xml-rpc 4fd5a03a36 36/64: xml-rpc.el: fix up callbacks for post emacs20!
Date: Fri, 31 Dec 2021 20:11:07 -0500 (EST)

branch: elpa/xml-rpc
commit 4fd5a03a36889f8dc4cb41ef93a2629040bef2c3
Author: Alex Bennée <alex.bennee@linaro.org>
Commit: Alex Bennée <alex.bennee@linaro.org>

    xml-rpc.el: fix up callbacks for post emacs20!
    
    I'm actually testing this on Emacs 24 but it's manifestly wrong to get
    url-retrieve to call the callback function directly. We need to process
    the XML response first. As the call back function seem different I
    wrapped it in a new handler.
    
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 xml-rpc.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xml-rpc.el b/xml-rpc.el
index 02e03ea979..bfc21f880d 100644
--- a/xml-rpc.el
+++ b/xml-rpc.el
@@ -592,7 +592,9 @@ or nil if called with ASYNC-CALLBACK-FUNCTION."
                      result)))
                 (t                      ; Post emacs20 w3-el
                  (if async-callback-function
-                     (url-retrieve server-url async-callback-function)
+                     (let ((cbargs (list async-callback-function)))
+                       (url-retrieve server-url
+                                     'xml-new-rpc-request-callback-handler 
cbargs))
                    (let ((buffer (url-retrieve-synchronously server-url)))
                      (with-current-buffer buffer
                        (when (not (numberp url-http-response-status))
@@ -694,6 +696,12 @@ handled from XML-BUFFER."
     (funcall callback-fun (xml-rpc-xml-to-response xml-response))))
 
 
+(defun xml-new-rpc-request-callback-handler (status callback-fun)
+  "Handle a new style `url-retrieve' callback passing `STATUS' and 
`CALLBACK-FUN'."
+  (let ((xml-buffer (current-buffer)))
+    (xml-rpc-request-callback-handler callback-fun xml-buffer)))
+
+
 (defun xml-rpc-method-call-async (async-callback-func server-url method
                                                       &rest params)
   "Call an XML-RPC method asynchronously at SERVER-URL named METHOD with \



reply via email to

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