]> granicus.if.org Git - python/commitdiff
(py-execute-region): Watch out for shell-command-on-region killing a
authorBarry Warsaw <barry@python.org>
Wed, 25 Mar 1998 23:27:17 +0000 (23:27 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 25 Mar 1998 23:27:17 +0000 (23:27 +0000)
zero sized output buffer.

Misc/python-mode.el

index 2f5f76736ffb519f0e8ed34064ce6c838f6a1ab8..6d10dcfbb93ffc7ac796a60b52c21e8a168b3bee 100644 (file)
@@ -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)