1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-17 03:10:58 -08:00

Cleanup prompts when sending region to shell.

This commit is contained in:
Fabián Ezequiel Gallina 2012-05-17 00:02:52 -03:00 committed by Fabián Ezequiel Gallina
parent 45c138ac0f
commit 6ac2041b86

View file

@ -1002,7 +1002,8 @@ commands.)"
(let* ((contents (buffer-substring start end)) (let* ((contents (buffer-substring start end))
(current-file (buffer-file-name)) (current-file (buffer-file-name))
(process (python-shell-get-or-create-process)) (process (python-shell-get-or-create-process))
(temp-file (make-temp-file "py"))) (temp-file (make-temp-file "py"))
(process-buffer (process-buffer process)))
(with-temp-file temp-file (with-temp-file temp-file
(insert contents) (insert contents)
(delete-trailing-whitespace) (delete-trailing-whitespace)
@ -1012,7 +1013,11 @@ commands.)"
(line-end-position))))) (line-end-position)))))
(with-current-buffer (process-buffer process) (with-current-buffer (process-buffer process)
(setq inferior-python-mode-current-file current-file) (setq inferior-python-mode-current-file current-file)
(setq inferior-python-mode-current-temp-file temp-file)) (setq inferior-python-mode-current-temp-file temp-file)
(delete-region (save-excursion
(move-to-column 0)
(point-marker))
(line-end-position)))
(comint-send-string process (format "execfile(r'%s')\n" temp-file)))) (comint-send-string process (format "execfile(r'%s')\n" temp-file))))
(defun python-shell-send-buffer () (defun python-shell-send-buffer ()
@ -1146,7 +1151,6 @@ It is specially designed to be added to the
(display-completion-list (display-completion-list
(all-completions input completions)))))))) (all-completions input completions))))))))
(defun python-shell-completion-complete-or-indent () (defun python-shell-completion-complete-or-indent ()
"Complete or indent depending on the context. "Complete or indent depending on the context.
If content before pointer is all whitespace indent. If not try to If content before pointer is all whitespace indent. If not try to