From: Fabián Ezequiel Gallina Date: Tue, 17 Jul 2012 16:47:58 +0000 (-0300) Subject: * progmodes/python.el (python-shell-send-string-no-output): Allow X-Git-Tag: emacs-24.2.90~1162 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=191da00ee25cec5d13f257720ef401fc31203384;p=emacs.git * 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 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 34fe5a509f4..8fbe6d35940 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-07-17 Fabián Ezequiel Gallina + + * 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 * emacs-lisp/cl-macs.el (cl-progv): Use a properly prefixed var name. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index e0a58d1523e..f6a1fbf3ab7 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -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.