mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 09:01:40 -05:00
M-. works in shared output buffer now
Currently, ein:propagate-connect does not work in the shared output buffer because ein:$shared-output has no reference to notebook.
This commit is contained in:
parent
2dfcffcba5
commit
ffa9dba8be
2 changed files with 21 additions and 2 deletions
|
@ -47,7 +47,8 @@
|
|||
(defun ein:pytools-get-kernel ()
|
||||
(cond
|
||||
(ein:notebook (ein:$notebook-kernel ein:notebook))
|
||||
(ein:@connect (ein:connect-get-kernel))))
|
||||
(ein:@connect (ein:connect-get-kernel))
|
||||
((eq major-mode 'ein:shared-output-mode) (ein:shared-output-get-kernel))))
|
||||
|
||||
(defun ein:pytools-get-notebook ()
|
||||
(cond
|
||||
|
@ -55,7 +56,7 @@
|
|||
(ein:@connect (ein:connect-get-notebook))))
|
||||
|
||||
(defun ein:pytools-get-notebook-buffer ()
|
||||
(ein:notebook-buffer (ein:pytools-get-notebook)))
|
||||
(ein:aand (ein:pytools-get-notebook) (ein:notebook-buffer it)))
|
||||
|
||||
(defun ein:pytools-setup-hooks (kernel)
|
||||
(push (cons #'ein:pytools-add-sys-path kernel)
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
(defmethod ein:cell-execute ((cell ein:shared-output-cell) kernel code
|
||||
&optional popup)
|
||||
(oset cell :popup popup)
|
||||
(oset cell :kernel kernel)
|
||||
(ein:cell-execute-internal cell kernel code :silent nil))
|
||||
|
||||
(defmethod ein:cell--handle-output ((cell ein:shared-output-cell)
|
||||
|
@ -95,6 +96,7 @@
|
|||
(setq ein:@shared-output
|
||||
(ein:$shared-output "SharedOutput" :ewoc ewoc :cell cell))
|
||||
(ein:cell-enter-last cell))
|
||||
(ein:shared-output-mode)
|
||||
ein:@shared-output)))
|
||||
|
||||
(defun ein:shared-output-bind-events (events)
|
||||
|
@ -106,11 +108,27 @@
|
|||
Create a cell if the buffer has none."
|
||||
(oref (ein:shared-output-get-or-create) :cell))
|
||||
|
||||
(defun ein:shared-output-get-kernel ()
|
||||
(let ((cell (ein:shared-output-get-cell)))
|
||||
(when (slot-boundp cell :kernel)
|
||||
(oref cell :kernel))))
|
||||
|
||||
(defun ein:shared-output-pop-to-buffer ()
|
||||
(interactive)
|
||||
(ein:shared-output-get-or-create)
|
||||
(pop-to-buffer (ein:shared-output-get-buffer)))
|
||||
|
||||
|
||||
;;; ein:shared-output-mode
|
||||
|
||||
(define-derived-mode ein:shared-output-mode fundamental-mode "ein:so"
|
||||
"Shared output mode."
|
||||
(font-lock-mode))
|
||||
|
||||
(let ((map ein:shared-output-mode-map))
|
||||
(define-key map "\M-." 'ein:pytools-jump-to-source-command))
|
||||
|
||||
|
||||
(provide 'ein-shared-output)
|
||||
|
||||
;;; ein-shared-output.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue