Commit graph

14 commits

Author SHA1 Message Date
Takafumi Arakaki
95434c845d Use ein:query-ajax in ein:notebook-request-open 2012-05-26 20:41:47 +02:00
Takafumi Arakaki
f6bcb438e8 Rename s/data-type/parser/g 2012-05-26 20:23:22 +02:00
Takafumi Arakaki
5a65aba368 Add DATA-TYPE argument to ein:query-ajax
This solves the problem due to the url-retrieve gotcha.

Main changes:
* Separation of the function to parse buffer and callback.
  This is good because parsed data can be used from multiple
  callbacks (SUCCESS and STATUS-CODE).
* As a result, current buffer for callbacks is not process
  buffer anymore. Callbacks should not assume any particular
  current buffer.
* RESPONSE-STATUS is added to the arguments for callbacks
  to pass around the value of url-http-response-status.

Previous attempts:
* cb5f53c183:
  Simpler and better fix than the previous one
* fff269fc39:
  ein:notebooklist-delete-notebook works again
2012-05-26 20:12:31 +02:00
Takafumi Arakaki
cb5f53c183 Simpler and better fix than the previous one
Previous fix ignores callbacks even if it is specified if the buffer
is killed.  This is simply wrong.  As the user of :STATUS-CODE
callback does not touch current buffer, I change the spec.
2012-05-26 19:25:00 +02:00
Takafumi Arakaki
fff269fc39 ein:notebooklist-delete-notebook works again
The bug was in ein:query-ajax-callback.  When url-retrieve called in
its callback (which is the case of ein:notebooklist-delete-notebook),
same process buffer is reused.  Therefore, old code killed another
buffer (namely notebook list buffer) by accident and the variable
url-http-response-status was void because it is outside of the process
buffer (I am not sure about this part).  Current workaround is to
check if the buffer is live before executing buffer, using new macro
ein:with-live-buffer.
2012-05-26 19:08:15 +02:00
Takafumi Arakaki
55eb908993 Remove unused url-http-method in ajax callback 2012-05-26 17:22:08 +02:00
Takafumi Arakaki
fb67781402 Fix ein:query-ajax-callback
Callback must be wrapped one by one.  Fix "url-http-response-status is
void" error when calling ein:notebooklist-open.
2012-05-26 17:20:20 +02:00
Takafumi Arakaki
56d92f9121 Revert "Suppress error: url-http-response-status is void"
This reverts commit 48a8f3835e.

Conflicts:

	ein-query.el
2012-05-26 17:18:34 +02:00
Takafumi Arakaki
4d1166dcbd Fix bugs in ein:notebooklist-open
There was two bugs:

* Process buffer was killed in ein:notebooklist-url-retrieve-callback
  where should be handled by ein:query-ajax-callback.  There was two
  calls of kill-buffer.  This is why the list buffer was killed.

* At the time ein:query-ajax-cancel-timer is called in
  ein:query-ajax-callback the current buffer was changed because
  pop-to-buffer is called in the callback.  Wrapping callbacks
  with save-current-buffer fixes the problem.
2012-05-26 17:13:17 +02:00
Takafumi Arakaki
ef8f59a3bf Fix arguments for run-at-time in ein-query 2012-05-26 17:01:23 +02:00
Takafumi Arakaki
a06442194a Bit better ein:query-ajax-cancel-timer 2012-05-26 17:00:21 +02:00
Takafumi Arakaki
48a8f3835e Suppress error: url-http-response-status is void 2012-05-26 16:59:42 +02:00
Takafumi Arakaki
4011a79ace Add ein:query-ajax-cancel-timer 2012-05-26 16:37:12 +02:00
Takafumi Arakaki
82d5cffeca Add ein-query.el 2012-05-25 21:57:59 +02:00