Add ein:get-traceback-data generic getter

This commit is contained in:
Takafumi Arakaki 2012-08-14 20:35:47 +02:00
parent 4d4e22912b
commit 2faeb54475
5 changed files with 21 additions and 0 deletions

View file

@ -990,6 +990,11 @@ Called from ewoc pretty printer via `ein:cell-insert-output'."
(defmethod ein:cell-has-image-ouput-p ((cell ein:textcell))
nil)
(defmethod ein:cell-get-tb-data ((cell ein:codecell))
(loop for out in (oref cell :outputs)
when (equal (plist-get out :output_type) "pyerr")
return (plist-get out :traceback)))
(provide 'ein-cell)
;;; ein-cell.el ends here

View file

@ -281,6 +281,11 @@ See also: `ein:connect-run-buffer', `ein:connect-eval-buffer'."
(defun ein:get-kernel--connect ()
(ein:aand (ein:get-notebook--connect) (ein:$notebook-kernel it)))
(defun ein:get-traceback-data--connect ()
;; FIXME: Check if the TB in shared-output buffer is originated from
;; the current buffer.
(ein:aand (ein:shared-output-get-cell) (ein:cell-get-tb-data it)))
;;; Auto-execution

View file

@ -1282,6 +1282,9 @@ as usual."
(defalias 'ein:get-cell-at-point--notebook 'ein:notebook-get-current-cell)
(defun ein:get-traceback-data--notebook ()
(ein:aand (ein:notebook-get-current-cell) (ein:cell-get-tb-data it)))
;;; Imenu

View file

@ -165,6 +165,9 @@ where CELL locates."
(when (ein:$shared-output-p ein:@shared-output)
(oref ein:@shared-output :cell)))
(defun ein:get-traceback-data--shared-output ()
(ein:aand (ein:get-cell-at-point--shared-output) (ein:cell-get-tb-data it)))
;;; ein:shared-output-mode

View file

@ -501,6 +501,11 @@ requires same object but can operate in different contexts."
(ein:generic-getter '(ein:get-cell-at-point--notebook
ein:get-cell-at-point--shared-output)))
(defun ein:get-traceback-data ()
(ein:generic-getter '(ein:get-traceback-data--notebook
ein:get-traceback-data--shared-output
ein:get-traceback-data--connect)))
;;; File name translation (tramp support)