From 229d0a495aafea72669c1cf59fdfa5c35817d8c2 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 2 Sep 2010 18:25:57 +0100 Subject: [PATCH 2/2] oauth-url-retrieve: Accept a cb-data parameter for the async callback The url-retrieve function has a callback data parameter that gets passed to the async callback if it's specified. This adds a similar optional parameter to oauth-url-retrieve. The parameter is useful because elisp doesn't support closures so there's no other convient way to pass back data to the callback. --- oauth.el | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/oauth.el b/oauth.el index add2a88..b4f01de 100644 --- a/oauth.el +++ b/oauth.el @@ -179,7 +179,7 @@ Returns an oauth-access-token if everything was successful." :consumer-secret consumer-secret :auth-t auth-t))) -(defun oauth-url-retrieve (access-token url &optional async-callback) +(defun oauth-url-retrieve (access-token url &optional async-callback cb-data) "Like url retrieve, with url-request-extra-headers set to the necessary oauth headers." (let ((req (oauth-make-request @@ -198,7 +198,8 @@ oauth headers." (oauth-request-to-header req))) (url-request-method (oauth-request-http-method req))) (cond - (async-callback (url-retrieve (oauth-request-url req) async-callback)) + (async-callback (url-retrieve (oauth-request-url req) + async-callback cb-data)) (oauth-use-curl (oauth-curl-retrieve (oauth-request-url req))) (t (url-retrieve-synchronously (oauth-request-url req))))))) -- 1.7.1.87.g94e70