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>
python.el: Cleanup temp files even with eval errors.

View file

@ -2577,23 +2577,30 @@ the python shell:
(line-beginning-position) (line-end-position))))
(buffer-substring-no-properties (point-min) (point-max)))))
(defun python-shell-send-region (start end &optional nomain)
"Send the region delimited by START and END to inferior Python process."
(interactive "r")
(let* ((string (python-shell-buffer-substring start end nomain))
(defun python-shell-send-region (start end &optional send-main)
"Send the region delimited by START and END to inferior Python process.
When optional argument SEND-MAIN is non-nil, allow execution of
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))
(_ (string-match "\\`\n*\\(.*\\)" string)))
(message "Sent: %s..." (match-string 1 string))
(original-string (buffer-substring-no-properties start end))
(_ (string-match "\\`\n*\\(.*\\)" original-string)))
(message "Sent: %s..." (match-string 1 original-string))
(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.
With prefix ARG allow execution of code inside blocks delimited
by \"if __name__== '__main__':\"."
When optional argument SEND-MAIN is non-nil, allow execution of
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")
(save-restriction
(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)
"Send the current defun to inferior Python process.