mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-04 16:51:38 -05:00
ein-completer: Robuster oinfo
By covering our ears and ignoring as much as possible. Apparently SyntaxError is not a subtype of Exception. Also need to send raw strings otherwise unicode characters will cause fits. Also added new command, `ein:pytools-reinject` to reinject ein's pytools code. The name could probably use some work.
This commit is contained in:
parent
3c6f29bed8
commit
fcb4040850
4 changed files with 102 additions and 71 deletions
160
Demo.ipynb
160
Demo.ipynb
File diff suppressed because one or more lines are too long
|
@ -139,7 +139,7 @@ notebook buffers and connected buffers."
|
|||
(if (ein:kernel-live-p kernel)
|
||||
(ein:kernel-execute
|
||||
kernel
|
||||
(format "__ein_print_object_info_for(__ein_maybe_undefined_object(\"%s\", locals()))" obj)
|
||||
(format "__ein_print_object_info_for(__ein_maybe_undefined_object(r\"%s\", locals()))" obj)
|
||||
(list
|
||||
:output `(,(lambda (d &rest args) (deferred:callback-post d args)) . ,d)))
|
||||
(deferred:callback-post d (list nil nil)))
|
||||
|
|
|
@ -67,6 +67,15 @@ If OTHER-WINDOW is non-`nil', open the file in the other window."
|
|||
kernel
|
||||
(buffer-string)))))
|
||||
|
||||
(defun ein:pytools-reinject ()
|
||||
"Re-send ein's pytools code to the current kernel.
|
||||
|
||||
If the kernel is reset by the notebook server then it may become
|
||||
necessary to call this command to ensure pytools continue
|
||||
working."
|
||||
(interactive)
|
||||
(ein:pytools-load-safely (ein:get-kernel-or-error)))
|
||||
|
||||
(defun ein:pytools-add-sys-path (kernel)
|
||||
(ein:kernel-execute
|
||||
kernel
|
||||
|
|
|
@ -94,6 +94,8 @@ def __ein_maybe_undefined_object(obj, locals=None):
|
|||
return eval(obj, None, locals)
|
||||
except Exception:
|
||||
return None
|
||||
except SyntaxError:
|
||||
return None
|
||||
|
||||
def __ein_print_object_info_for(obj):
|
||||
import IPython.core.oinspect
|
||||
|
|
Loading…
Add table
Reference in a new issue