1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 14:30:50 -08:00

Enhance 'python-shell-send-block' for convenience

* lisp/progmodes/python.el (python-shell-send-block):
'python-shell-send-block' will now send block without header
by default.
* test/lisp/progmodes/python-tests.el
(python-test--shell-send-block): Update the test case.
(Bug#71083)
This commit is contained in:
Lin Sun 2024-05-20 06:55:31 +00:00 committed by Eli Zaretskii
parent 9ca89cb483
commit b241ec0e78
2 changed files with 5 additions and 5 deletions

View file

@ -4156,14 +4156,14 @@ interactively."
"Send the block at point to inferior Python process.
The block is delimited by `python-nav-beginning-of-block' and
`python-nav-end-of-block'. If optional argument ARG is non-nil
(interactively, the prefix argument), send the block body without
\(interactively, the prefix argument), send the block body with
its header. If optional argument MSG is non-nil, force display
of a user-friendly message if there's no process running; this
always happens interactively."
(interactive (list current-prefix-arg t))
(let ((beg (save-excursion
(when (python-nav-beginning-of-block)
(if (null arg)
(if arg
(beginning-of-line)
(python-nav-end-of-statement)
(beginning-of-line 2)))
@ -4172,7 +4172,7 @@ always happens interactively."
(python-indent-guess-indent-offset-verbose nil))
(if (and beg end)
(python-shell-send-region beg end nil msg t)
(user-error "Can't get code block from current position."))))
(user-error "Can't get code block from current position"))))
(defun python-shell-send-buffer (&optional send-main msg)
"Send the entire buffer to inferior Python process.