Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebc7b7a

Browse files
committed
More ME patches:
(py-shell): Recognize the Python debugger prompt (py-jump-to-exception): Force into python-mode any buffer that gets jumped to on exception. Cope with py-exception-buffer possibly a cons.
1 parent 145ab1c commit ebc7b7a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Misc/python-mode.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ filter."
12521252
(switch-to-buffer-other-window
12531253
(apply 'make-comint py-which-bufname py-which-shell nil py-which-args))
12541254
(make-local-variable 'comint-prompt-regexp)
1255-
(setq comint-prompt-regexp "^>>> \\|^[.][.][.] ")
1255+
(setq comint-prompt-regexp "^>>> \\|^[.][.][.] \\|^(pdb) ")
12561256
(set-process-filter (get-buffer-process (current-buffer)) 'py-process-filter)
12571257
(set-syntax-table py-mode-syntax-table)
12581258
;; set up keybindings for this subshell
@@ -1354,7 +1354,9 @@ See the `\\[py-execute-region]' docs for an account of some subtleties."
13541354

13551355
(defun py-jump-to-exception (file line)
13561356
(let ((buffer (cond ((string-equal file "<stdin>")
1357-
py-exception-buffer)
1357+
(if (consp py-exception-buffer)
1358+
(cdr py-exception-buffer)
1359+
py-exception-buffer))
13581360
((and (consp py-exception-buffer)
13591361
(string-equal file (car py-exception-buffer)))
13601362
(cdr py-exception-buffer))
@@ -1365,6 +1367,9 @@ See the `\\[py-execute-region]' docs for an account of some subtleties."
13651367
nil
13661368
file t))))))
13671369
(pop-to-buffer buffer)
1370+
;; Force Python mode
1371+
(if (not (eq major-mode) 'python-mode)
1372+
(python-mode))
13681373
(goto-line line)
13691374
(message "Jumping to exception in file %s on line %d" file line)))
13701375

0 commit comments

Comments
 (0)