Kaydet (Commit) 512af04b authored tarafından Barry Warsaw's avatar Barry Warsaw

(py-execute-region): Watch out for shell-command-on-region killing a

zero sized output buffer.
üst 69c70a2f
...@@ -1133,6 +1133,7 @@ Electric behavior is inhibited inside a string or comment." ...@@ -1133,6 +1133,7 @@ Electric behavior is inhibited inside a string or comment."
(set-buffer curbuf)))) (set-buffer curbuf))))
(defun py-postprocess-output-buffer (buf) (defun py-postprocess-output-buffer (buf)
;; Highlight exceptions found in BUF
(let (line file bol) (let (line file bol)
(save-excursion (save-excursion
(set-buffer buf) (set-buffer buf)
...@@ -1257,10 +1258,15 @@ is inserted at the end. See also the command `py-clear-queue'." ...@@ -1257,10 +1258,15 @@ is inserted at the end. See also the command `py-clear-queue'."
(t (t
;; otherwise either run it synchronously in a subprocess ;; otherwise either run it synchronously in a subprocess
(shell-command-on-region start end py-python-command py-output-buffer) (shell-command-on-region start end py-python-command py-output-buffer)
(setq py-exception-buffer (current-buffer)) ;; shell-command-on-region kills the output buffer if it never
(py-postprocess-output-buffer py-output-buffer) ;; existed and there's no output from the command
(pop-to-buffer py-output-buffer) (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 ;; Code execution command
(defun py-execute-buffer (&optional async) (defun py-execute-buffer (&optional async)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment