mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 23:41:38 -05:00
Only insert error messages when they are from us and when they have a traceback
This commit is contained in:
parent
5c89657995
commit
fec7183933
1 changed files with 25 additions and 12 deletions
|
@ -876,18 +876,31 @@ lines then truncate it to something less than
|
||||||
(pop-up-windows . t)))))))
|
(pop-up-windows . t)))))))
|
||||||
|
|
||||||
(cl-defmethod jupyter-handle-error ((client jupyter-repl-client)
|
(cl-defmethod jupyter-handle-error ((client jupyter-repl-client)
|
||||||
req ename evalue traceback)
|
req ename _evalue traceback)
|
||||||
(jupyter-repl-do-at-request client req
|
;; When the request is from us
|
||||||
(save-excursion
|
(when req
|
||||||
;; `point' is at the cell beginning of the next cell after REQ,
|
(jupyter-repl-do-at-request client req
|
||||||
;; `jupyter-repl-previous-cell' will take us back to the start of the
|
(save-excursion
|
||||||
;; cell corresponding to REQ.
|
;; `point' is at the cell beginning of the next cell after REQ,
|
||||||
(jupyter-repl-previous-cell)
|
;; `jupyter-repl-previous-cell' will take us back to the start of the
|
||||||
(jupyter-repl-cell-unmark-busy))
|
;; cell corresponding to REQ.
|
||||||
(let ((s (mapconcat #'xterm-color-filter traceback "\n")))
|
(jupyter-repl-previous-cell)
|
||||||
(jupyter-repl-add-font-lock-properties 0 (length s) s)
|
(jupyter-repl-cell-unmark-busy))
|
||||||
(jupyter-repl-insert s))
|
(when traceback
|
||||||
(jupyter-repl-newline)))
|
(let ((pos (point)))
|
||||||
|
(jupyter-repl-insert-ansi-coded-text
|
||||||
|
(mapconcat #'identity traceback "\n"))
|
||||||
|
(when (eq jupyter-repl-lang-mode 'python-mode)
|
||||||
|
;; Fix spacing between error name and Traceback
|
||||||
|
(save-excursion
|
||||||
|
(goto-char pos)
|
||||||
|
(when (search-forward ename nil t)
|
||||||
|
(let ((len (- (length jupyter-repl-error-prefix)
|
||||||
|
(- (point) (line-beginning-position))
|
||||||
|
(- (line-end-position) (point)))))
|
||||||
|
(jupyter-repl-insert
|
||||||
|
(make-string (if (> len 4) len 4) ? )))))))
|
||||||
|
(jupyter-repl-newline)))))
|
||||||
|
|
||||||
(cl-defmethod jupyter-handle-input-reply ((client jupyter-repl-client) req prompt password)
|
(cl-defmethod jupyter-handle-input-reply ((client jupyter-repl-client) req prompt password)
|
||||||
(jupyter-repl-do-at-request client req
|
(jupyter-repl-do-at-request client req
|
||||||
|
|
Loading…
Add table
Reference in a new issue