mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
Mainly code style changes
This commit is contained in:
parent
670611ded1
commit
7d7b7650b9
4 changed files with 21 additions and 26 deletions
|
@ -723,10 +723,9 @@ received for it."
|
|||
with secs = '(0 1)
|
||||
for req in (hash-table-values requests)
|
||||
for id = (jupyter-request-id req)
|
||||
for ltime = (jupyter-request-last-message-time req)
|
||||
when (and (jupyter-request-idle-received-p req)
|
||||
(time-less-p
|
||||
secs (time-subtract
|
||||
ctime (jupyter-request-last-message-time req))))
|
||||
(time-less-p secs (time-subtract ctime ltime)))
|
||||
do (when jupyter--debug
|
||||
(message "DROPPING-REQ: %s" id))
|
||||
(remhash id requests)))
|
||||
|
|
|
@ -176,8 +176,8 @@
|
|||
(declare (indent 1))
|
||||
(cl-destructuring-bind (msg-id . msg)
|
||||
(jupyter--encode-message session type :content message)
|
||||
(zmq-send-multipart socket msg flags)
|
||||
msg-id))
|
||||
(prog1 msg-id
|
||||
(zmq-send-multipart socket msg flags))))
|
||||
|
||||
(cl-defmethod jupyter-recv ((session jupyter-session) socket &optional flags)
|
||||
(let ((msg (zmq-recv-multipart socket flags)))
|
||||
|
|
|
@ -1393,14 +1393,12 @@ takes."
|
|||
(setq matches (cdr matches))))
|
||||
(when types
|
||||
(let ((max-len (apply #'max (mapcar #'length matches))))
|
||||
(cl-mapcar
|
||||
(cl-mapc
|
||||
(lambda (match meta)
|
||||
(put-text-property
|
||||
0 1 'annot
|
||||
(concat (make-string (1+ (- max-len (length match))) ? )
|
||||
(plist-get meta :type))
|
||||
match)
|
||||
match)
|
||||
(let ((prefix (make-string (1+ (- max-len (length match))) ? )))
|
||||
(put-text-property
|
||||
0 1 'annot (concat prefix (plist-get meta :type))
|
||||
match)))
|
||||
matches types)))
|
||||
matches))
|
||||
|
||||
|
@ -1620,7 +1618,7 @@ A kernel can be interrupted if it was started using a
|
|||
(oref jupyter-repl-current-client manager))))
|
||||
|
||||
;; TODO: Make timeouts configurable
|
||||
(defun jupyter-repl-restart-kernel (shutdown)
|
||||
(defun jupyter-repl-restart-kernel (&optional shutdown)
|
||||
"Restart the kernel.
|
||||
With a prefix argument, SHUTDOWN the kernel completely instead."
|
||||
(interactive "P")
|
||||
|
@ -1647,9 +1645,10 @@ With a prefix argument, SHUTDOWN the kernel completely instead."
|
|||
(jupyter-shutdown-kernel manager (not shutdown)))
|
||||
(message "Starting dead kernel...")
|
||||
(jupyter-start-kernel manager)))
|
||||
(when (null (jupyter-wait-until-received :shutdown-reply
|
||||
(jupyter-shutdown-request jupyter-repl-current-client
|
||||
:restart (not shutdown))))
|
||||
(unless (jupyter-wait-until-received :shutdown-reply
|
||||
(jupyter-shutdown-request jupyter-repl-current-client
|
||||
:restart (not shutdown)))
|
||||
(jupyter-set jupyter-repl-current-client 'jupyter-include-other-output nil)
|
||||
(message "Kernel did not respond to shutdown request"))))
|
||||
|
||||
(defun jupyter-repl-display-kernel-buffer ()
|
||||
|
@ -2041,12 +2040,10 @@ Otherwise, in a non-interactive call, return the
|
|||
"Run a Jupyter REPL using a kernel's connection FILE-OR-PLIST.
|
||||
FILE-OR-PLIST can be either a file holding the connection
|
||||
information or a property list of connection information.
|
||||
|
||||
ASSOCIATE-BUFFER has the same meaning as in `run-jupyter-repl'.
|
||||
|
||||
When called interactively, display the new REPL buffer.
|
||||
Otherwise, in a non-interactive call return the
|
||||
`jupyter-repl-client' connected to the kernel."
|
||||
Return the `jupyter-repl-client' connected to the kernel. When
|
||||
called interactively, display the new REPL buffer as well."
|
||||
(interactive (list (read-file-name "Connection file: ") t))
|
||||
(let ((client (make-instance 'jupyter-repl-client)))
|
||||
(jupyter-initialize-connection client file-or-plist)
|
||||
|
@ -2063,9 +2060,9 @@ Otherwise, in a non-interactive call return the
|
|||
(when (and associate-buffer
|
||||
(eq major-mode (jupyter-repl-language-mode client)))
|
||||
(jupyter-repl-associate-buffer client))
|
||||
(if (called-interactively-p 'interactive)
|
||||
(pop-to-buffer (oref client buffer))
|
||||
client))))
|
||||
(when (called-interactively-p 'interactive)
|
||||
(pop-to-buffer (oref client buffer)))
|
||||
client)))
|
||||
|
||||
(provide 'jupyter-repl-client)
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
(require 'jupyter)
|
||||
(require 'ob)
|
||||
|
||||
(declare-function cddar "cl" (x))
|
||||
(declare-function org-element-at-point "org-element")
|
||||
(declare-function org-at-drawer-p "org")
|
||||
(declare-function org-element-property "org-element" (property element))
|
||||
|
@ -557,8 +556,8 @@ the PARAMS alist."
|
|||
(lambda ()
|
||||
(org-babel-jupyter--clear-render-param render-param params)
|
||||
(org-babel-jupyter--inject-render-param "append" params)
|
||||
(org-babel-jupyter-insert-results
|
||||
(cdr results) params kernel-lang)))))))))))
|
||||
(org-babel-jupyter-insert-results (cdr results) params kernel-lang)
|
||||
(set-marker block-beginning nil)))))))))))
|
||||
|
||||
(defun org-babel-jupyter-make-language-alias (kernel lang)
|
||||
"Simimilar to `org-babel-make-language-alias' but for Jupyter src-blocks.
|
||||
|
|
Loading…
Add table
Reference in a new issue