Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed parameter ordering in assoc-string calls #15

Closed
wants to merge 12 commits into from
4 changes: 4 additions & 0 deletions .dir-locals.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((emacs-lisp-mode (indent-tabs-mode . nil)))
26 changes: 13 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ GET::
"http://httpbin.org/get"
:params '(("key" . "value") ("key2" . "value2"))
:parser 'json-read
:success (function*
:success (cl-function
(lambda (&key data &allow-other-keys)
(message "I sent: %S" (assoc-default 'args data)))))

Expand All @@ -54,7 +54,7 @@ POST::
:data '(("key" . "value") ("key2" . "value2"))
;; :data "key=value&key2=value2" ; this is equivalent
:parser 'json-read
:success (function*
:success (cl-function
(lambda (&key data &allow-other-keys)
(message "I sent: %S" (assoc-default 'form data)))))

Expand All @@ -66,7 +66,7 @@ POST file (**WARNING**: it will send the contents of the current buffer!)::
:files `(("current buffer" . ,(current-buffer))
("data" . ("data.csv" :data "1,2,3\n4,5,6\n")))
:parser 'json-read
:success (function*
:success (cl-function
(lambda (&key data &allow-other-keys)
(message "I sent: %S" (assoc-default 'files data)))))

Expand All @@ -78,15 +78,15 @@ Rich callback dispatch (like `jQuery.ajax`)::
;; "http://httpbin.org/status/400" ; you will see "Got 400."
:parser 'buffer-string
:success
(function* (lambda (&key data &allow-other-keys)
(when data
(with-current-buffer (get-buffer-create "*request demo*")
(erase-buffer)
(insert data)
(pop-to-buffer (current-buffer))))))
(cl-function (lambda (&key data &allow-other-keys)
(when data
(with-current-buffer (get-buffer-create "*request demo*")
(erase-buffer)
(insert data)
(pop-to-buffer (current-buffer))))))
:error
(function* (lambda (&key error-thrown &allow-other-keys&rest _)
(message "Got error: %S" error-thrown)))
(cl-function (lambda (&rest args &key error-thrown &allow-other-keys)
(message "Got error: %S" error-thrown)))
:complete (lambda (&rest _) (message "Finished!"))
:status-code '((400 . (lambda (&rest _) (message "Got 400.")))
(418 . (lambda (&rest _) (message "Got 418.")))))
Expand All @@ -97,7 +97,7 @@ Flexible PARSER option::
"https://github.com/tkf/emacs-request/commits/master.atom"
;; Parse XML in response body:
:parser (lambda () (libxml-parse-xml-region (point) (point-max)))
:success (function*
:success (cl-function
(lambda (&key data &allow-other-keys)
;; Just don't look at this function....
(let ((get (lambda (node &rest names)
Expand All @@ -119,7 +119,7 @@ PUT JSON data::
:data (json-encode '(("key" . "value") ("key2" . "value2")))
:headers '(("Content-Type" . "application/json"))
:parser 'json-read
:success (function*
:success (cl-function
(lambda (&key data &allow-other-keys)
(message "I sent: %S" (assoc-default 'json data)))))

Expand Down
Loading