(defun python-shell-send-block (&optional arg msg)
"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'. When optional argument ARG is non-nil, send
-the block body without its header. When optional argument MSG is
-non-nil, forces display of a user-friendly message if there's no process
-running; defaults to t when called interactively."
+`python-nav-end-of-block'. If optional argument ARG is non-nil
+(interactively, the prefix argument), send the block body without
+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)
for x in range(1,3):
print('current %s' % x)
print('current 3')"
- (goto-line 1)
+ (goto-char (point-min))
(should-error (python-shell-send-block) :type 'user-error)
- (goto-line 2)
+ (forward-line)
(python-shell-send-block)
(python-tests-shell-wait-for-prompt)
(python-shell-with-shell-buffer
(should (re-search-forward "current 1" nil t))
(should (re-search-forward "current 2" nil t))
(should-not (re-search-forward "current 3" nil t)))
- (goto-line 3)
+ (forward-line)
(python-shell-send-block t) ;; send block body only
(python-tests-shell-wait-for-prompt)
(python-shell-with-shell-buffer