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

Use request.el #95

Merged
merged 8 commits into from
Jan 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ log-clean:
rm -rf log

travis-ci-testein: ert-compile env-ipy.$(IPY_VERSION)
${MAKE} testein-2

testein-2: testein-2-url-retrieve testein-2-curl

testein-2-curl:
EL_REQUEST_BACKEND=curl ${MAKE} testein-1

testein-2-url-retrieve:
EL_REQUEST_BACKEND=url-retrieve ${MAKE} testein-1

testein-1:
$(EMACS) --version
python --version
env/ipy.$(IPY_VERSION)/bin/ipython --version
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Requirements

* IPython_ 0.12 or higher.
* `websocket.el`_ 0.9
* `request.el`_ >= 0.2
* (optional) mumamo_ developmental version:
It will be automatically loaded when it is on the path.
The official way to setup path is to load nXhtml_.
Expand All @@ -126,6 +127,7 @@ It is known to work in Emacs 23.2, 24.1 and 24.2.

.. _IPython: http://ipython.org/
.. _websocket.el: https://github.com/ahyatt/emacs-websocket
.. _request.el: https://github.com/tkf/emacs-request
.. _mumamo: http://www.emacswiki.org/emacs/MuMaMo
.. _nXhtml: http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html
.. _python.el: https://github.com/fgallina/python.el
Expand Down
7 changes: 7 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Requirements

* IPython_ 0.12 or higher.
* `websocket.el`_ 0.9
* `request.el`_ >= 0.2
* (optional) mumamo_ developmental version:
It will be automatically loaded when it is on the path.
The official way to setup path is to load nXhtml_.
Expand All @@ -110,6 +111,7 @@ It is known to work in Emacs 23.2, 24.1 and 24.2.

.. _IPython: http://ipython.org/
.. _websocket.el: https://github.com/ahyatt/emacs-websocket
.. _request.el: https://github.com/tkf/emacs-request
.. _mumamo: http://www.emacswiki.org/emacs/MuMaMo
.. _nXhtml: http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html
.. _python.el: https://github.com/fgallina/python.el
Expand Down Expand Up @@ -542,6 +544,11 @@ with :el:symbol:`ein:dev-stop-debug`.
Change Log
==========

v0.2.1
------

* Use request.el_ for smoother experience.

v0.2
----

Expand Down
3 changes: 2 additions & 1 deletion lisp/ein-dev.el
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,12 @@ callback (`websocket-callback-debug-on-error') is enabled."
:image-types (ein:eval-if-bound 'image-types)
:image-types-available (ein:filter #'image-type-available-p
(ein:eval-if-bound 'image-types))
:request (list :backend request-backend)
:ein (append (list :version (ein:version))
(ein:dev-dump-vars '("source-dir")))
:lib (ein:filter (lambda (info) (plist-get info :path))
(mapcar #'ein:dev-sys-info--lib
'("websocket" "auto-complete" "mumamo"
'("websocket" "request" "auto-complete" "mumamo"
"auto-complete" "popup" "fuzzy" "pos-tip"
"python" "python-mode" "markdown-mode"
"smartrep" "anything" "helm")))))
Expand Down
24 changes: 7 additions & 17 deletions lisp/ein-notebooklist.el
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,14 @@ This function is called via `ein:notebook-after-rename-hook'."
&aux
(no-popup t)
(error (request-response-error-thrown response))
(redirects (request-response-redirects response))
(redirect (car (last redirects))))
(dest (request-response-url response)))
(ein:log 'verbose
"NOTEBOOKLIST-NEW-NOTEBOOK-ERROR url-or-port: %S; error: %S; redirects: %S"
url-or-port error redirects)
(if redirect
;; Workaround the redirection bug in `url-retrieve'.
;; See: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12374
(let ((notebook-id
(ein:trim
(url-filename (url-generic-parse-url redirect)) "/")))
(ein:log 'info "Creating a new notebook... Done.")
(ein:notebook-open url-or-port notebook-id callback cbargs))
(ein:log 'error
(concat "Failed to open new notebook (error: %S). "
"You may find the new one in the notebook list.")
error)
(setq no-popup nil))
"NOTEBOOKLIST-NEW-NOTEBOOK-ERROR url-or-port: %S; error: %S; dest: %S"
url-or-port error dest)
(ein:log 'error
"Failed to open new notebook (error: %S). \
You may find the new one in the notebook list." error)
(setq no-popup nil)
(ein:notebooklist-open url-or-port no-popup))

;;;###autoload
Expand Down
3 changes: 2 additions & 1 deletion lisp/ein-org.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ S-expression based (rather verbose) serialization, so that
extending link spec without loosing backward compatibility is
easier. For the examples of link format in general, see Info
node `(org) External links' and Info node `(org) Search options'"
(ein:and-let* ((notebook (ein:get-notebook))
(ein:and-let* (((ein:worksheet-buffer-p))
(notebook (ein:get-notebook))
(name (ein:notebook-name notebook))
(link (list :url-or-port (ein:get-url-or-port)
:name name))
Expand Down
2 changes: 1 addition & 1 deletion lisp/ein-pkg.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"0.2.0alpha0"
"Emacs IPython Notebook"
'((websocket "0.9")
(request "0.1")
(request "0.2")
;; `auto-complete' is not really a dependency, but who use EIN w/o AC?
(auto-complete "1.4")))
5 changes: 5 additions & 0 deletions tests/func-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
(require 'ein-testing)
(require 'ein-testing-cell)

(let ((backend (getenv "EL_REQUEST_BACKEND")))
(when (and backend (not (equal backend "")))
(setq request-backend (intern backend))
(message "Using request-backend = %S" request-backend)))

(ein:setq-if-not ein:testing-dump-file-log "func-test-batch-log.log")
(ein:setq-if-not ein:testing-dump-file-messages "func-test-batch-messages.log")
(setq message-log-max t)
Expand Down