aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorLin Sun2024-05-20 06:55:31 +0000
committerEli Zaretskii2024-05-26 11:23:12 +0300
commitb241ec0e78f141e7fc22cf3afb11037d14fc028c (patch)
tree0fd2cfe9683ab071434c290c684af8cbf0691b92 /lisp/progmodes/python.el
parent9ca89cb4834a20bc7d38289046d4d05e2212ba50 (diff)
downloademacs-b241ec0e78f141e7fc22cf3afb11037d14fc028c.tar.gz
emacs-b241ec0e78f141e7fc22cf3afb11037d14fc028c.zip
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)
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index fea52b2f7d6..b5c00385ef3 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -4156,14 +4156,14 @@ interactively."
4156 "Send the block at point to inferior Python process. 4156 "Send the block at point to inferior Python process.
4157The block is delimited by `python-nav-beginning-of-block' and 4157The block is delimited by `python-nav-beginning-of-block' and
4158`python-nav-end-of-block'. If optional argument ARG is non-nil 4158`python-nav-end-of-block'. If optional argument ARG is non-nil
4159(interactively, the prefix argument), send the block body without 4159\(interactively, the prefix argument), send the block body with
4160its header. If optional argument MSG is non-nil, force display 4160its header. If optional argument MSG is non-nil, force display
4161of a user-friendly message if there's no process running; this 4161of a user-friendly message if there's no process running; this
4162always happens interactively." 4162always happens interactively."
4163 (interactive (list current-prefix-arg t)) 4163 (interactive (list current-prefix-arg t))
4164 (let ((beg (save-excursion 4164 (let ((beg (save-excursion
4165 (when (python-nav-beginning-of-block) 4165 (when (python-nav-beginning-of-block)
4166 (if (null arg) 4166 (if arg
4167 (beginning-of-line) 4167 (beginning-of-line)
4168 (python-nav-end-of-statement) 4168 (python-nav-end-of-statement)
4169 (beginning-of-line 2))) 4169 (beginning-of-line 2)))
@@ -4172,7 +4172,7 @@ always happens interactively."
4172 (python-indent-guess-indent-offset-verbose nil)) 4172 (python-indent-guess-indent-offset-verbose nil))
4173 (if (and beg end) 4173 (if (and beg end)
4174 (python-shell-send-region beg end nil msg t) 4174 (python-shell-send-region beg end nil msg t)
4175 (user-error "Can't get code block from current position.")))) 4175 (user-error "Can't get code block from current position"))))
4176 4176
4177(defun python-shell-send-buffer (&optional send-main msg) 4177(defun python-shell-send-buffer (&optional send-main msg)
4178 "Send the entire buffer to inferior Python process. 4178 "Send the entire buffer to inferior Python process.