Skip to content

Commit 4a272ea

Browse files
committed
Read an expression when a prefix arg. is present
* jupyter-client.el (jupyter-inspect-at-point): Do it.
1 parent b617f72 commit 4a272ea

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

jupyter-client.el

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,15 +1175,24 @@ SOURCE."
11751175
;;;; Inspection
11761176

11771177
;; TODO: How to add hover documentation support
1178-
(defun jupyter-inspect-at-point (&optional buffer detail)
1178+
(defun jupyter-inspect-at-point (&optional buffer detail interactive)
11791179
"Inspect the code at point.
11801180
Call `jupyter-inspect' for the `jupyter-code-context' at point.
1181-
1182-
BUFFER and DETAIL have the same meaning as in `jupyter-inspect'."
1183-
(interactive (list nil 0))
1184-
(cl-destructuring-bind (code pos)
1185-
(jupyter-code-context 'inspect)
1186-
(jupyter-inspect code pos buffer detail)))
1181+
When called interactively with a non-nil prefix argument, read an
1182+
expression to inspect from the minibuffer instead.
1183+
1184+
BUFFER and DETAIL have the same meaning as in `jupyter-inspect'.
1185+
INTERACTIVE is an internal argument set when this function is
1186+
called interactively."
1187+
(interactive (list nil 0 t))
1188+
(pcase
1189+
(if (and interactive current-prefix-arg)
1190+
(let ((code (jupyter-read-expression
1191+
(format "Inspect (%s): " (jupyter-kernel-language)))))
1192+
(list code (length code)))
1193+
(jupyter-code-context 'inspect))
1194+
(`(,code ,pos)
1195+
(jupyter-inspect code pos buffer detail))))
11871196

11881197
(cl-defgeneric jupyter-inspect (code &optional pos buffer detail)
11891198
"Inspect CODE.

0 commit comments

Comments
 (0)