diff options
author | Barry Warsaw <barry@python.org> | 1998-03-25 23:27:17 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1998-03-25 23:27:17 (GMT) |
commit | 512af04b35e51fa4ee9fb9321322931612d0871d (patch) | |
tree | 156ab8067485e29b60cfbca93f69d0aec925f2f8 | |
parent | 69c70a2fd1a23739e9cb4fb7f75e76d4e56172ef (diff) | |
download | cpython-512af04b35e51fa4ee9fb9321322931612d0871d.zip cpython-512af04b35e51fa4ee9fb9321322931612d0871d.tar.gz cpython-512af04b35e51fa4ee9fb9321322931612d0871d.tar.bz2 |
(py-execute-region): Watch out for shell-command-on-region killing a
zero sized output buffer.
-rw-r--r-- | Misc/python-mode.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el index 2f5f767..6d10dcf 100644 --- a/Misc/python-mode.el +++ b/Misc/python-mode.el @@ -1133,6 +1133,7 @@ Electric behavior is inhibited inside a string or comment." (set-buffer curbuf)))) (defun py-postprocess-output-buffer (buf) + ;; Highlight exceptions found in BUF (let (line file bol) (save-excursion (set-buffer buf) @@ -1257,10 +1258,15 @@ is inserted at the end. See also the command `py-clear-queue'." (t ;; otherwise either run it synchronously in a subprocess (shell-command-on-region start end py-python-command py-output-buffer) - (setq py-exception-buffer (current-buffer)) - (py-postprocess-output-buffer py-output-buffer) - (pop-to-buffer py-output-buffer) - )))) + ;; shell-command-on-region kills the output buffer if it never + ;; existed and there's no output from the command + (if (not (get-buffer py-output-buffer)) + (message "No output.") + (setq py-exception-buffer (current-buffer)) + (py-postprocess-output-buffer py-output-buffer) + (pop-to-buffer py-output-buffer) + )) + ))) ;; Code execution command (defun py-execute-buffer (&optional async) |