From 191da00ee25cec5d13f257720ef401fc31203384 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Tue, 17 Jul 2012 13:47:58 -0300 Subject: [PATCH] * 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 --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/python.el | 29 +++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) 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. -- 2.39.2