mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 09:31:39 -05:00

As emacs users we prefer and have the luxury of fuzzy file navigation via ido and projectile. From a notebook or notebooklist buffer, the commands `C-c C-f` ein:file-open `C-c C-o` ein:notebook-open offer an ido alternative to point and click navigation. To populate the ido lists, retrieving the content hierarchy is on by default. Two custom variables determine how wide and deep the content query probes (currently at 2 levels deep and 6 directories wide). Set both to zero to turn off. tkf half finished code to quickly go from local file buffers to notebook mode via `C-c C-z` or `C-c C-o`. This is now possible. EIN will start the server from a suitable parent directory of the visited file. Enable ido completion for `notebooklist-login`. Remove the albatross `ein-loaddefs.el` in favor of more standard `ein-autoloads.el` that is not git tracked. Convenience `make install` from git source (local alternative to melpa).
52 lines
1.8 KiB
EmacsLisp
52 lines
1.8 KiB
EmacsLisp
(eval-when-compile (require 'cl))
|
|
(require 'f)
|
|
(require 'espuds)
|
|
(require 'ert)
|
|
|
|
(let* ((support-path (f-dirname load-file-name))
|
|
(root-path (f-parent (f-parent support-path))))
|
|
(add-to-list 'load-path (concat root-path "/lisp"))
|
|
(add-to-list 'load-path (concat root-path "/test")))
|
|
|
|
(require 'ein-notebooklist)
|
|
(require 'ein-jupyter)
|
|
(require 'ein-dev)
|
|
(require 'ein-testing)
|
|
(require 'ein-ipynb-mode)
|
|
(require 'ein-contents-api)
|
|
|
|
(defvar ein:testing-jupyter-server-root (f-parent (f-dirname load-file-name)))
|
|
|
|
(defun ein:testing-after-scenario ()
|
|
(ein:testing-flush-queries)
|
|
(with-current-buffer (ein:notebooklist-get-buffer (car (ein:jupyter-server-conn-info)))
|
|
(if ein:%notebooklist%
|
|
(let ((urlport (ein:$notebooklist-url-or-port ein:%notebooklist%)))
|
|
(loop for notebook in (ein:notebook-opened-notebooks)
|
|
for path = (ein:$notebook-notebook-path notebook)
|
|
do (ein:notebook-kill-kernel-then-close-command notebook t)
|
|
(if (search "Untitled" path )
|
|
(ein:notebooklist-delete-notebook path))))))
|
|
(ein:testing-flush-queries))
|
|
|
|
(Setup
|
|
(ein:dev-start-debug)
|
|
(setq ein:notebook-autosave-frequency 0)
|
|
(setq ein:testing-dump-file-log (concat default-directory "log/ecukes.log"))
|
|
(setq ein:testing-dump-file-messages (concat default-directory "log/ecukes.messages"))
|
|
(setq ein:testing-dump-file-server (concat default-directory "log/ecukes.server"))
|
|
(setq ein:testing-dump-file-request (concat default-directory "log/ecukes.request"))
|
|
(Given "I start and login to the server configured \"\\n\"")
|
|
)
|
|
|
|
(After
|
|
(ein:testing-after-scenario))
|
|
|
|
(Teardown
|
|
(cl-letf (((symbol-function 'y-or-n-p) #'ignore))
|
|
(ein:jupyter-server-stop t)))
|
|
|
|
(Fail
|
|
(if noninteractive
|
|
(ein:testing-after-scenario)
|
|
(keyboard-quit))) ;; useful to prevent emacs from quitting
|