diff options
author | Barry Warsaw <barry@python.org> | 1998-03-26 16:08:59 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1998-03-26 16:08:59 (GMT) |
commit | f9b99f437569736076891d5dad80851be4f8cfdc (patch) | |
tree | 1263a0c945d961978527853eabe698b1f5c71b74 /Misc | |
parent | 512af04b35e51fa4ee9fb9321322931612d0871d (diff) | |
download | cpython-f9b99f437569736076891d5dad80851be4f8cfdc.zip cpython-f9b99f437569736076891d5dad80851be4f8cfdc.tar.gz cpython-f9b99f437569736076891d5dad80851be4f8cfdc.tar.bz2 |
(py-postprocess-output-buffer): Return t if an exception was found,
otherwise return nil.
(py-execute-region): When executing the buffer asynchronously in a
subprocess, if an exception occurred, show both the output buffer and
the file containing the exception, leaving point on the source line
containing bottom-most error in the traceback. If no exception
occurred, jump to the output buffer (no change).
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/python-mode.el | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el index 6d10dcf..211fd3c 100644 --- a/Misc/python-mode.el +++ b/Misc/python-mode.el @@ -1133,8 +1133,9 @@ 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) + ;; Highlight exceptions found in BUF. If an exception occurred + ;; return t, otherwise return nil. BUF must exist. + (let (line file bol err-p) (save-excursion (set-buffer buf) (beginning-of-buffer) @@ -1142,11 +1143,12 @@ Electric behavior is inhibited inside a string or comment." (setq file (match-string 1) line (string-to-int (match-string 2)) bol (py-point 'bol)) - (py-highlight-line bol (py-point 'eol) file line)) - (when (and py-jump-on-exception line) - (beep) - (py-jump-to-exception file line)) - ))) + (py-highlight-line bol (py-point 'eol) file line))) + (when (and py-jump-on-exception line) + (beep) + (py-jump-to-exception file line) + (setq err-p t)) + err-p)) @@ -1263,8 +1265,10 @@ is inserted at the end. See also the command `py-clear-queue'." (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) + (let ((err-p (py-postprocess-output-buffer py-output-buffer))) + (pop-to-buffer py-output-buffer) + (if err-p + (pop-to-buffer py-exception-buffer))) )) ))) |