mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-04 16:51:38 -05:00
remove longstanding recursive requires workaround
This commit is contained in:
parent
e9ede451a3
commit
54cb27701f
15 changed files with 41 additions and 59 deletions
|
@ -12,12 +12,11 @@
|
|||
(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)
|
||||
(require 'ein-file)
|
||||
(require 'poly-ein)
|
||||
(require 'ob-ein)
|
||||
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
(require 'anaphora)
|
||||
(require 'ein-notebook)
|
||||
|
||||
|
||||
;;; Utils
|
||||
|
||||
(defun ein:maybe-save-buffer (option)
|
||||
"Conditionally save current buffer.
|
||||
Return `t' if the buffer is unmodified or `nil' otherwise.
|
||||
|
|
|
@ -35,8 +35,9 @@
|
|||
(require 'ein-utils)
|
||||
(require 'ein-log)
|
||||
(require 'ein-query)
|
||||
(provide 'ein-notebook) ; see manual "Named Features" regarding recursive requires
|
||||
(require 'ein-notebook)
|
||||
|
||||
(declare-function ein:notebook-to-json "ein-notebook")
|
||||
(declare-function ein:notebooklist-url "ein-notebooklist")
|
||||
|
||||
(defcustom ein:content-query-max-depth 2
|
||||
"Don't recurse the directory tree deeper than this."
|
||||
|
|
|
@ -93,15 +93,9 @@ pair of TO-PYTHON and FROM-PYTHON."
|
|||
:group 'ein)
|
||||
|
||||
|
||||
|
||||
;;; Constants
|
||||
|
||||
(defconst ein:source-dir (file-name-directory load-file-name)
|
||||
"Directory in which `ein*.el` files are located.")
|
||||
|
||||
|
||||
;;; Configuration getter
|
||||
|
||||
(defun ein:version (&optional interactively copy-to-kill)
|
||||
"Return a longer version string.
|
||||
With prefix argument, copy the string to kill ring.
|
||||
|
@ -322,12 +316,6 @@ but can operate in different contexts."
|
|||
ein:get-url-or-port--worksheet
|
||||
ein:get-url-or-port--shared-output)))
|
||||
|
||||
(defsubst ein:get-notebook () ein:%notebook%)
|
||||
|
||||
(defun ein:get-notebook-or-error ()
|
||||
(or (ein:get-notebook)
|
||||
(error "No notebook related to the current buffer.")))
|
||||
|
||||
(defun ein:get-kernel ()
|
||||
(ein:generic-getter '(ein:get-kernel--notebook
|
||||
ein:get-kernel--worksheet
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
;;; Commentary:
|
||||
|
||||
(require 'ein-contents-api)
|
||||
|
||||
(defvar *ein:file-buffername-template* "'/ein:%s:%s")
|
||||
(ein:deflocal ein:content-file-buffer--content nil)
|
||||
|
||||
|
|
|
@ -33,12 +33,14 @@
|
|||
(require 'ein-core)
|
||||
(require 'ein-classes)
|
||||
(require 'ein-log)
|
||||
;; FIXME: use websocket.el directly once v1.0 is released.
|
||||
(require 'ein-websocket)
|
||||
(require 'ein-events)
|
||||
(require 'ein-query)
|
||||
(require 'ein-ipdb)
|
||||
;; "Public" getters. Use them outside of this package.
|
||||
|
||||
(declare-function ein:notebook-get-opened-notebook "ein-notebook")
|
||||
(declare-function ein:notebooklist-get-buffer "ein-notebooklist")
|
||||
(declare-function ein:notebooklist-reload "ein-notebooklist")
|
||||
|
||||
(defun ein:$kernel-session-url (kernel)
|
||||
(concat "/api/sessions/" (ein:$kernel-session-id kernel)))
|
||||
|
|
|
@ -33,18 +33,12 @@
|
|||
;;; Code:
|
||||
|
||||
|
||||
(require 'ewoc)
|
||||
(require 'company nil t)
|
||||
(require 'eldoc nil t)
|
||||
(require 'ein-core)
|
||||
(require 'ein-classes)
|
||||
(require 'ein-log)
|
||||
(require 'ein-node)
|
||||
(require 'ein-contents-api)
|
||||
(require 'ein-kernel)
|
||||
(require 'ein-file)
|
||||
(require 'ein-notebooklist)
|
||||
(require 'ein-kernelinfo)
|
||||
(require 'ein-cell)
|
||||
(require 'ein-worksheet)
|
||||
(require 'ein-scratchsheet)
|
||||
(require 'ein-notification)
|
||||
(require 'ein-completer)
|
||||
|
@ -55,9 +49,6 @@
|
|||
(require 'ein-query)
|
||||
(require 'ein-pytools)
|
||||
(require 'ein-traceback)
|
||||
(require 'ein-shared-output)
|
||||
(require 'ein-notebooklist)
|
||||
(require 'poly-ein)
|
||||
|
||||
(autoload 'ob-ein-anonymous-p "ob-ein")
|
||||
|
||||
|
@ -114,9 +105,13 @@ Current buffer for these functions is set to the notebook buffer.")
|
|||
(ein:deflocal ein:%notebook% nil
|
||||
"Buffer local variable to store an instance of `ein:$notebook'.")
|
||||
|
||||
(defsubst ein:get-notebook () ein:%notebook%)
|
||||
|
||||
(defun ein:get-notebook-or-error ()
|
||||
(or (ein:get-notebook)
|
||||
(error "No notebook related to the current buffer.")))
|
||||
|
||||
(define-obsolete-variable-alias 'ein:notebook 'ein:%notebook% "0.1.2")
|
||||
|
||||
;;; Constructor
|
||||
|
||||
(defun ein:notebook-new (url-or-port notebook-path pre-kernelspec &rest args)
|
||||
(let ((kernelspec
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
(require 'cus-edit)
|
||||
|
||||
(require 'ein-core)
|
||||
(require 'ein-notebook)
|
||||
(require 'ein-file)
|
||||
(require 'ein-contents-api)
|
||||
(require 'deferred)
|
||||
(require 'dash)
|
||||
|
@ -41,6 +39,7 @@
|
|||
(declare-function ein:jupyter-server-conn-info "ein-jupyter")
|
||||
(declare-function ein:jupyter-get-default-kernel "ein-jupyter")
|
||||
(declare-function ein:jupyter-crib-running-servers "ein-jupyter")
|
||||
(declare-function ein:file-open "ein-file")
|
||||
|
||||
(defcustom ein:notebooklist-login-timeout (truncate (* 6.3 1000))
|
||||
"Timeout in milliseconds for logging into server"
|
||||
|
|
|
@ -28,14 +28,14 @@
|
|||
|
||||
(require 'eieio)
|
||||
|
||||
(require 'ein-notebook)
|
||||
(require 'ein-core)
|
||||
(require 'ein-classes)
|
||||
(require 'ein-events)
|
||||
|
||||
|
||||
;; Class and variable
|
||||
|
||||
(declare-function ein:get-notebook "ein:notebook")
|
||||
(declare-function ein:notebook-opened-buffer-names "ein:notebook")
|
||||
(declare-function ein:list-available-kernels "ein:notebook")
|
||||
(declare-function ein:notebook-switch-kernel "ein:notebook")
|
||||
|
||||
(ein:deflocal ein:%notification% nil
|
||||
"Buffer local variable to hold an instance of `ein:notification'.")
|
||||
|
@ -199,7 +199,7 @@ insert-prev insert-next move-prev move-next)"
|
|||
'help-echo "Click (mouse-1) to insert a new tab."
|
||||
'mouse-face 'highlight
|
||||
'face 'ein:notification-tab-normal)
|
||||
(propertize (aif (and ein:%notebook% (ein:$notebook-kernelspec ein:%notebook%))
|
||||
(propertize (aif (and (ein:get-notebook) (ein:$notebook-kernelspec (ein:get-notebook)))
|
||||
(format "|%s|" (ein:$kernelspec-name it))
|
||||
"|unknown: please click and select a kernel|")
|
||||
'keymap ein:header-line-switch-kernel-map
|
||||
|
@ -207,9 +207,6 @@ insert-prev insert-next move-prev move-next)"
|
|||
'mouse-face 'highlight
|
||||
'face 'ein:notification-tab-normal))))))
|
||||
|
||||
|
||||
;;; Header line
|
||||
|
||||
(let ((map ein:header-line-tab-map))
|
||||
(define-key map [header-line M-mouse-1] 'ein:header-line-insert-prev-tab)
|
||||
(define-key map [header-line M-mouse-3] 'ein:header-line-insert-next-tab)
|
||||
|
|
|
@ -26,9 +26,11 @@
|
|||
;;; Code:
|
||||
|
||||
(require 'ein-core)
|
||||
(require 'ein-jupyter)
|
||||
(require 'ein-file)
|
||||
(require 'ein-notebooklist)
|
||||
|
||||
(declare-function ein:notebook-open "ein-notebook")
|
||||
(declare-function ein:notebooklist-list-get "ein-notebooklist")
|
||||
(declare-function ein:notebooklist-login "ein-notebooklist")
|
||||
(declare-function ein:jupyter-server-start "ein-jupyter")
|
||||
|
||||
(defcustom ein:process-jupyter-regexp "\\(jupyter\\|ipython\\)\\(-\\|\\s-+\\)note"
|
||||
"Regexp by which we recognize notebook servers."
|
||||
|
@ -119,6 +121,8 @@
|
|||
(setq directory (directory-file-name (file-name-directory directory)))
|
||||
finally return suitable)))
|
||||
|
||||
(defvar ein:jupyter-server-command)
|
||||
(defvar ein:jupyter-server-use-subcommand)
|
||||
(defun ein:process-refresh-processes ()
|
||||
"Use `jupyter notebook list --json` to populate ein:%processes%"
|
||||
(clrhash ein:%processes%)
|
||||
|
@ -162,6 +166,8 @@
|
|||
"Construct path by eliding PROC's dir from filename"
|
||||
(cl-subseq filename (length (file-name-as-directory (ein:$process-dir proc)))))
|
||||
|
||||
(defvar ein:jupyter-use-containers)
|
||||
(defvar ein:jupyter-docker-mount-point)
|
||||
(defun ein:process-open-notebook* (filename callback)
|
||||
"Open FILENAME as a notebook and start a notebook server if necessary. CALLBACK with arity 2 (passed into `ein:notebook-open--callback')."
|
||||
(ein:process-refresh-processes)
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
;;; Code:
|
||||
|
||||
(require 'ein-kernel)
|
||||
(require 'ein-notebook)
|
||||
|
||||
(defun ein:pytools-request-help (kernel func)
|
||||
(interactive (list (ein:get-kernel-or-error)
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
(require 'ein-core)
|
||||
(require 'ein-shared-output)
|
||||
|
||||
(declare-function ein:get-notebook "ein-notebook")
|
||||
(declare-function ein:notebook-buffer "ein-notebook")
|
||||
|
||||
(defclass ein:traceback ()
|
||||
((tb-data :initarg :tb-data :type list)
|
||||
(notebook :initarg :source-notebook ;; :type ein:$notebook
|
||||
|
|
|
@ -290,9 +290,6 @@ See: http://api.jquery.com/jQuery.ajax/"
|
|||
See also: https://github.com/tkf/emacs-ipython-notebook/issues/49")
|
||||
(error "Incompatible EWOC version."))))
|
||||
|
||||
|
||||
;;; Text property
|
||||
|
||||
(defun ein:propertize-read-only (string &rest properties)
|
||||
(apply #'propertize string 'read-only t 'front-sticky t properties))
|
||||
|
||||
|
|
|
@ -940,18 +940,16 @@ It is set in `ein:notebook-multilang-mode'."
|
|||
;; effectively kill and yank modulo dirtying kill ring
|
||||
(aif (if up (ein:cell-prev cell) (ein:cell-next cell))
|
||||
(let ((inhibit-read-only t)
|
||||
(pivot-cell it) clone)
|
||||
(pivot-cell it))
|
||||
(ein:cell-save-text cell)
|
||||
(ein:worksheet-delete-cell ws cell)
|
||||
(ein:cell-deactivate cell)
|
||||
|
||||
;; the clone conveniently makes otl zero
|
||||
;; (as opposed to ein:worksheet-insert-cell)
|
||||
(setq clone (ein:worksheet-insert-clone ws cell pivot-cell (if up "above" "below")))
|
||||
(ein:cell-goto clone)
|
||||
(oset ws :dirty t)
|
||||
(when pm/polymode
|
||||
(poly-ein-fontify-buffer (ein:worksheet--get-buffer ein:%worksheet%))))
|
||||
(ein:cell-goto
|
||||
(ein:worksheet-insert-clone ws cell pivot-cell (if up "above" "below")))
|
||||
(poly-ein-fontify-buffer (ein:worksheet--get-buffer ws)))
|
||||
(message "No %s cell" (if up "previous" "next"))))
|
||||
|
||||
(defun ein:worksheet-not-move-cell (which)
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
(require 'display-line-numbers nil t)
|
||||
(require 'undo-tree nil t)
|
||||
|
||||
(declare-function ein:get-notebook "ein-notebook")
|
||||
(declare-function ein:notebook-mode "ein-notebook")
|
||||
|
||||
(declare-function polymode-inhibit-during-initialization "polymode-core")
|
||||
|
||||
(defmacro poly-ein--remove-hook (label functions)
|
||||
|
|
Loading…
Add table
Reference in a new issue