python.el: Fix message when sending region.

* lisp/progmodes/python.el (python-shell-send-region): Rename argument
send-name from nomain.  Fix message.
(python-shell-send-buffer): Rename argument send-name from arg.
This commit is contained in:
Fabián Ezequiel Gallina 2014-12-27 04:01:32 -03:00
parent 800260c4eb
commit 7e9dfded93
2 changed files with 25 additions and 10 deletions

View file

@ -1,3 +1,11 @@
2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
python.el: Fix message when sending region.
* progmodes/python.el (python-shell-send-region): Rename argument
send-name from nomain. Fix message.
(python-shell-send-buffer): Rename argument send-name from arg.
2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
python.el: Cleanup temp files even with eval errors. python.el: Cleanup temp files even with eval errors.

View file

@ -2577,23 +2577,30 @@ the python shell:
(line-beginning-position) (line-end-position)))) (line-beginning-position) (line-end-position))))
(buffer-substring-no-properties (point-min) (point-max))))) (buffer-substring-no-properties (point-min) (point-max)))))
(defun python-shell-send-region (start end &optional nomain) (defun python-shell-send-region (start end &optional send-main)
"Send the region delimited by START and END to inferior Python process." "Send the region delimited by START and END to inferior Python process.
(interactive "r") When optional argument SEND-MAIN is non-nil, allow execution of
(let* ((string (python-shell-buffer-substring start end nomain)) code inside blocks delimited by \"if __name__== '__main__':\".
When called interactively SEND-MAIN defaults to nil, unless it's
called with prefix argument."
(interactive "r\nP")
(let* ((string (python-shell-buffer-substring start end (not send-main)))
(process (python-shell-get-or-create-process)) (process (python-shell-get-or-create-process))
(_ (string-match "\\`\n*\\(.*\\)" string))) (original-string (buffer-substring-no-properties start end))
(message "Sent: %s..." (match-string 1 string)) (_ (string-match "\\`\n*\\(.*\\)" original-string)))
(message "Sent: %s..." (match-string 1 original-string))
(python-shell-send-string string process))) (python-shell-send-string string process)))
(defun python-shell-send-buffer (&optional arg) (defun python-shell-send-buffer (&optional send-main)
"Send the entire buffer to inferior Python process. "Send the entire buffer to inferior Python process.
With prefix ARG allow execution of code inside blocks delimited When optional argument SEND-MAIN is non-nil, allow execution of
by \"if __name__== '__main__':\"." code inside blocks delimited by \"if __name__== '__main__':\".
When called interactively SEND-MAIN defaults to nil, unless it's
called with prefix argument."
(interactive "P") (interactive "P")
(save-restriction (save-restriction
(widen) (widen)
(python-shell-send-region (point-min) (point-max) (not arg)))) (python-shell-send-region (point-min) (point-max) send-main)))
(defun python-shell-send-defun (arg) (defun python-shell-send-defun (arg)
"Send the current defun to inferior Python process. "Send the current defun to inferior Python process.