-
-
Notifications
You must be signed in to change notification settings - Fork 97
Add jupyter-describe function for interactive inspect #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -946,24 +946,32 @@ client local variable. | |
|
||
Methods that extend this generic function should | ||
`cl-call-next-method' as a last step." | ||
(cl-check-type jupyter-current-client jupyter-kernel-client | ||
"Need a client to read an expression") | ||
(let* ((client jupyter-current-client) | ||
(jupyter--read-expression-history | ||
(jupyter-get client 'jupyter-eval-expression-history))) | ||
(minibuffer-with-setup-hook | ||
(lambda () | ||
(setq jupyter-current-client client) | ||
(add-hook 'completion-at-point-functions | ||
'jupyter-completion-at-point nil t) | ||
(add-hook 'minibuffer-exit-hook | ||
'jupyter--teardown-minibuffer nil t)) | ||
(prog1 (read-from-minibuffer | ||
(format "Eval (%s): " (jupyter-kernel-language client)) | ||
nil read-expression-map | ||
nil 'jupyter--read-expression-history) | ||
(jupyter-set client 'jupyter-eval-expression-history | ||
jupyter--read-expression-history))))) | ||
(prog1 | ||
(jupyter--read-with-completion | ||
client "Eval (%s): " jupyter--read-expression-history) | ||
(jupyter-set client 'jupyter-eval-expression-history | ||
jupyter--read-expression-history)))) | ||
|
||
(defun jupyter--read-with-completion (client prompt &optional history) | ||
"Read an expression using CLIENT for completion. | ||
The expression is read from the minibuffer with PROMPT and expression | ||
history HISTORY." | ||
(cl-check-type client jupyter-kernel-client | ||
"Need a client to read an expression") | ||
(minibuffer-with-setup-hook | ||
(lambda () | ||
(setq jupyter-current-client client) | ||
(add-hook 'completion-at-point-functions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I copied it over from Although the documentation for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm. That makes sense. So for this new purpose I'm putting this code to, using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In either case, I think it probably makes more sense to just refactor |
||
'jupyter-completion-at-point nil t) | ||
(add-hook 'minibuffer-exit-hook | ||
'jupyter--teardown-minibuffer nil t)) | ||
(read-from-minibuffer | ||
(format prompt (jupyter-kernel-language client)) | ||
nil read-expression-map | ||
nil history))) | ||
|
||
(defun jupyter-eval (code &optional mime) | ||
"Send an execute request for CODE, wait for the execute result. | ||
|
@@ -1419,6 +1427,16 @@ BUFFER and DETAIL have the same meaning as in `jupyter-inspect'." | |
(jupyter-code-context 'inspect) | ||
(jupyter-inspect code pos buffer detail))) | ||
|
||
(cl-defgeneric jupyter-describe (code &optional buffer detail) | ||
"Inspect CODE provided interactively. | ||
Call `jupter-inspect' for CODE which can be interactively supplied by user. | ||
|
||
BUFFER and DETAIL have the same meaning a in `jupyter-inspect'." | ||
(interactive (list (jupyter--read-with-completion | ||
jupyter-current-client "Describe (%s): ") | ||
nil 0)) | ||
(jupyter-inspect code nil buffer detail)) | ||
|
||
(cl-defgeneric jupyter-inspect (code &optional pos buffer detail) | ||
"Inspect CODE. | ||
Send an `:inspect-request' with the `jupyter-current-client' and | ||
|
Uh oh!
There was an error while loading. Please reload this page.