1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

* progmodes/python.el (python-shell-send-string-no-output): Allow

accept-process-output to quit, keeping shell process ready for
future interactions.

Fixes: debbugs:11868
This commit is contained in:
Fabián Ezequiel Gallina 2012-07-17 13:47:58 -03:00
parent 6d02fe5b3b
commit 191da00ee2
2 changed files with 23 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2012-07-17 Fabián Ezequiel Gallina <fgallina@cuca>
* progmodes/python.el (python-shell-send-string-no-output): Allow
accept-process-output to quit, keeping shell process ready for
future interactions (Bug#11868).
2012-07-17 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/cl-macs.el (cl-progv): Use a properly prefixed var name.

View file

@ -1701,24 +1701,29 @@ When MSG is non-nil messages the first line of STRING."
"Send STRING to PROCESS and inhibit output.
When MSG is non-nil messages the first line of STRING. Return
the output."
(let* ((output-buffer)
(let* ((output-buffer "")
(process (or process (python-shell-get-or-create-process)))
(comint-preoutput-filter-functions
(append comint-preoutput-filter-functions
'(ansi-color-filter-apply
(lambda (string)
(setq output-buffer (concat output-buffer string))
"")))))
(python-shell-send-string string process msg)
(accept-process-output process)
(replace-regexp-in-string
(if (> (length python-shell-prompt-output-regexp) 0)
(format "\n*%s$\\|^%s\\|\n$"
python-shell-prompt-regexp
(or python-shell-prompt-output-regexp ""))
(format "\n*$\\|^%s\\|\n$"
python-shell-prompt-regexp))
"" output-buffer)))
""))))
(inhibit-quit t))
(or
(with-local-quit
(python-shell-send-string string process msg)
(accept-process-output process)
(replace-regexp-in-string
(if (> (length python-shell-prompt-output-regexp) 0)
(format "\n*%s$\\|^%s\\|\n$"
python-shell-prompt-regexp
(or python-shell-prompt-output-regexp ""))
(format "\n*$\\|^%s\\|\n$"
python-shell-prompt-regexp))
"" output-buffer))
(with-current-buffer (process-buffer process)
(comint-interrupt-subjob)))))
(defun python-shell-internal-send-string (string)
"Send STRING to the Internal Python interpreter.