mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
Add jupyter-repl-update-cell-count
This commit is contained in:
parent
da1340ac2d
commit
460b94f17f
1 changed files with 18 additions and 2 deletions
|
@ -434,6 +434,14 @@ should be a face that the prompt will use and defaults to
|
|||
(jupyter-repl-cell-update-prompt
|
||||
(format "In [%d] " (jupyter-repl-cell-count))))))
|
||||
|
||||
(defun jupyter-repl-update-cell-count (n)
|
||||
"Set the current cell count to N."
|
||||
(setf (nth 1 (get-text-property
|
||||
(jupyter-repl-cell-beginning-position)
|
||||
'jupyter-cell))
|
||||
n)
|
||||
(jupyter-repl-cell-reset-prompt))
|
||||
|
||||
(defun jupyter-repl-cell-count ()
|
||||
"Return the cell count of the cell at `point'."
|
||||
(let ((pos (if (jupyter-repl-cell-beginning-p) (point)
|
||||
|
@ -864,7 +872,10 @@ lines, truncate it to something less than
|
|||
(save-excursion
|
||||
(when (ignore-errors
|
||||
(progn (jupyter-repl-goto-cell req) t))
|
||||
(jupyter-repl-cell-unmark-busy)))))
|
||||
(jupyter-repl-cell-unmark-busy))
|
||||
;; Update the cell count and reset the prompt
|
||||
(goto-char (point-max))
|
||||
(jupyter-repl-update-cell-count (oref client execution-count)))))
|
||||
(force-mode-line-update))
|
||||
|
||||
(defun jupyter-repl-display-other-output (client stream text)
|
||||
|
@ -1565,7 +1576,12 @@ it."
|
|||
(jupyter-add-callback req
|
||||
:execute-reply (lambda (msg)
|
||||
(oset client execution-count
|
||||
(1+ (jupyter-message-get msg :execution_count)))))
|
||||
(1+ (jupyter-message-get msg :execution_count)))
|
||||
(unless (equal (jupyter-execution-state client) "busy")
|
||||
;; Set the cell count and update the prompt
|
||||
(jupyter-with-repl-buffer client
|
||||
(jupyter-repl-update-cell-count
|
||||
(oref client execution-count))))))
|
||||
;; Waiting longer here to account for initial startup of the Jupyter
|
||||
;; kernel. Sometimes the idle message won't be received if another long
|
||||
;; running execute request is sent right after.
|
||||
|
|
Loading…
Add table
Reference in a new issue