File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,6 +238,12 @@ the Emacs bell is also rung as a warning."
238238 :type 'boolean
239239 :group 'python )
240240
241+ (defcustom py-jump-on-exception t
242+ " *Jump to innermost exception frame in *Python Output* buffer.
243+ When this variable is non-nil and ane exception occurs when running
244+ Python code synchronously in a subprocess, jump immediately to the
245+ source code of the innermost frame." )
246+
241247(defcustom py-backspace-function 'backward-delete-char-untabify
242248 " *Function called by `py-electric-backspace' when deleting backwards."
243249 :type 'function
@@ -1043,15 +1049,21 @@ Electric behavior is inhibited inside a string or comment."
10431049 (set-buffer curbuf))))
10441050
10451051(defun py-postprocess-output-buffer (buf )
1046- (save-excursion
1047- (set-buffer buf)
1048- (beginning-of-buffer )
1049- (while (re-search-forward py-traceback-line-re nil t )
1050- (let ((file (match-string 1 ))
1051- (line (string-to-int (match-string 2 ))))
1052- (py-highlight-line (py-point 'bol ) (py-point 'eol ) file line))
1052+ (let (line file bol)
1053+ (save-excursion
1054+ (set-buffer buf)
1055+ (beginning-of-buffer )
1056+ (while (re-search-forward py-traceback-line-re nil t )
1057+ (setq file (match-string 1 )
1058+ line (string-to-int (match-string 2 ))
1059+ bol (py-point 'bol ))
1060+ (py-highlight-line bol (py-point 'eol ) file line))
1061+ (when (and py-jump-on-exception line)
1062+ (beep )
1063+ (py-jump-to-exception file line))
10531064 )))
10541065
1066+
10551067
10561068; ;; Subprocess commands
10571069
You can’t perform that action at this time.
0 commit comments