mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 01:21:38 -05:00
Normalize url-or-port
``` "http://localhost:8888" "http://localhost:8888/" "http://127.0.0.1:8888" "http://127.0.0.1:8888/" "8888" 8888 ``` Ideally these should converge to the same thing. Since many hash tables are keyed off `url-or-port`, forgetting to normalize `url-or-port` with `ein:url` leads to missed cache hits and general malaise. So we try to do that. Address a FIXME: apply callbacks to `ein:notebook-list-login-and-open`. Removed py3.5 from travis build matrix to reduce developer strain.
This commit is contained in:
parent
c888508751
commit
435d001b03
3 changed files with 41 additions and 10 deletions
|
@ -39,6 +39,26 @@
|
|||
(ein:$notebook-notebook-name notebook))))
|
||||
(switch-to-buffer buf-name)
|
||||
(Then "I should be in buffer \"%s\"" buf-name))))))
|
||||
(When "^I login if necessary"
|
||||
(lambda ()
|
||||
(multiple-value-bind (url-or-port token) (ein:jupyter-server-conn-info)
|
||||
(when token
|
||||
(When "I call \"ein:notebooklist-login\"")
|
||||
(And "I wait for the smoke to clear")))))
|
||||
|
||||
(When "^I wait for the smoke to clear"
|
||||
(lambda ()
|
||||
(ein:testing-flush-queries)))
|
||||
|
||||
(When "^I enter the prevailing port"
|
||||
(lambda ()
|
||||
(multiple-value-bind (url-or-port token) (ein:jupyter-server-conn-info)
|
||||
(let ((parsed-url (url-generic-parse-url url-or-port)))
|
||||
(When "I type \"%d\"") (url-port parsed-url)))))
|
||||
|
||||
(When "^I wait for the smoke to clear"
|
||||
(lambda ()
|
||||
(ein:testing-flush-queries)))
|
||||
|
||||
(When "^I open notebooklist"
|
||||
(lambda ()
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'ein-core)
|
||||
(require 'ein-notebooklist)
|
||||
|
||||
(defcustom ein:jupyter-server-buffer-name "*ein:jupyter-server*"
|
||||
"The name of the buffer to run a jupyter notebook server
|
||||
session in."
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
|
||||
(require 'ein-core)
|
||||
(require 'ein-notebook)
|
||||
|
||||
;; needs to be after ein-notebook else deferred in server-start breaks down
|
||||
;; has something to do with provide/require in contents-api
|
||||
(require 'ein-jupyter)
|
||||
|
||||
(require 'ein-connect)
|
||||
(require 'ein-file)
|
||||
(require 'ein-contents-api)
|
||||
|
@ -190,10 +195,15 @@ To suppress popup, you can pass `ignore' as CALLBACK."
|
|||
(ein:$notebooklist-url-or-port it)
|
||||
(ein:default-url-or-port)))))
|
||||
(url-or-port
|
||||
(if noninteractive
|
||||
;; noninteractive for testing only
|
||||
(multiple-value-bind (url-or-port token) (ein:jupyter-server-conn-info)
|
||||
(let ((parsed-url (url-generic-parse-url url-or-port)))
|
||||
(format "%d" (url-port parsed-url))))
|
||||
(completing-read (format "URL or port number (default %s): " default)
|
||||
url-or-port-list
|
||||
nil nil nil nil
|
||||
default)))
|
||||
default))))
|
||||
(ein:url url-or-port)))
|
||||
|
||||
(defcustom ein:populate-hierarchy-on-notebooklist-open nil
|
||||
|
@ -901,7 +911,11 @@ FIMXE: document how to use `ein:notebooklist-find-file-callback'
|
|||
(defun ein:notebooklist-login (url-or-port password callback &optional retry-p)
|
||||
"Login to URL-OR-PORT with PASSWORD with notebooklist-open CALLBACK of arity 0."
|
||||
(interactive (list (ein:notebooklist-ask-url-or-port)
|
||||
(read-passwd "Password: ")
|
||||
(if noninteractive
|
||||
;; noninteractive for testing only
|
||||
(multiple-value-bind (url-or-port token)
|
||||
(ein:jupyter-server-conn-info) token)
|
||||
(read-passwd "Password: "))
|
||||
nil))
|
||||
(if password
|
||||
(ein:query-singleton-ajax
|
||||
|
|
Loading…
Add table
Reference in a new issue