@@ -946,24 +946,32 @@ client local variable.
946
946
947
947
Methods that extend this generic function should
948
948
`cl-call-next-method' as a last step."
949
- (cl-check-type jupyter-current-client jupyter-kernel-client
950
- " Need a client to read an expression" )
951
949
(let* ((client jupyter-current-client)
952
950
(jupyter--read-expression-history
953
951
(jupyter-get client 'jupyter-eval-expression-history )))
954
- (minibuffer-with-setup-hook
955
- (lambda ()
956
- (setq jupyter-current-client client)
957
- (add-hook 'completion-at-point-functions
958
- 'jupyter-completion-at-point nil t )
959
- (add-hook 'minibuffer-exit-hook
960
- 'jupyter--teardown-minibuffer nil t ))
961
- (prog1 (read-from-minibuffer
962
- (format " Eval (%s ): " (jupyter-kernel-language client))
963
- nil read-expression-map
964
- nil 'jupyter--read-expression-history )
965
- (jupyter-set client 'jupyter-eval-expression-history
966
- jupyter--read-expression-history)))))
952
+ (prog1
953
+ (jupyter--read-with-completion
954
+ client " Eval (%s): " jupyter--read-expression-history)
955
+ (jupyter-set client 'jupyter-eval-expression-history
956
+ jupyter--read-expression-history))))
957
+
958
+ (defun jupyter--read-with-completion (client prompt &optional history )
959
+ " Read an expression using CLIENT for completion.
960
+ The expression is read from the minibuffer with PROMPT and expression
961
+ history HISTORY."
962
+ (cl-check-type client jupyter-kernel-client
963
+ " Need a client to read an expression" )
964
+ (minibuffer-with-setup-hook
965
+ (lambda ()
966
+ (setq jupyter-current-client client)
967
+ (add-hook 'completion-at-point-functions
968
+ 'jupyter-completion-at-point nil t )
969
+ (add-hook 'minibuffer-exit-hook
970
+ 'jupyter--teardown-minibuffer nil t ))
971
+ (read-from-minibuffer
972
+ (format prompt (jupyter-kernel-language client))
973
+ nil read-expression-map
974
+ nil history)))
967
975
968
976
(defun jupyter-eval (code &optional mime )
969
977
" 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'."
1419
1427
(jupyter-code-context 'inspect )
1420
1428
(jupyter-inspect code pos buffer detail)))
1421
1429
1430
+ (cl-defgeneric jupyter-describe (code &optional buffer detail)
1431
+ " Inspect CODE provided interactively.
1432
+ Call `jupter-inspect' for CODE which can be interactively supplied by user.
1433
+
1434
+ BUFFER and DETAIL have the same meaning a in `jupyter-inspect' ."
1435
+ (interactive (list (jupyter--read-with-completion
1436
+ jupyter-current-client " Describe (%s): " )
1437
+ nil 0 ))
1438
+ (jupyter-inspect code nil buffer detail))
1439
+
1422
1440
(cl-defgeneric jupyter-inspect (code &optional pos buffer detail)
1423
1441
" Inspect CODE.
1424
1442
Send an `:inspect-request' with the `jupyter-current-client' and
0 commit comments