diff options
| author | Fabián Ezequiel Gallina | 2013-01-30 12:02:58 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2013-01-30 12:02:58 -0300 |
| commit | 6ff930c3d206417e4cec9429fa5d71bb5c9af541 (patch) | |
| tree | 1f2c36d23a4948f1bdda2266130c1fc955581ce5 | |
| parent | fe93f41aa0f701315884bf0f8d2cbc6a9f914209 (diff) | |
| download | emacs-6ff930c3d206417e4cec9429fa5d71bb5c9af541.tar.gz emacs-6ff930c3d206417e4cec9429fa5d71bb5c9af541.zip | |
* progmodes/python.el
(python-pdbtrack-comint-output-filter-function): Enhancements on
stacktrace detection. (thanks @gnovak)
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 20 |
2 files changed, 17 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 41c5c7d1671..bd8f5c08274 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-01-30 Fabián Ezequiel Gallina <fgallina@cuca> | ||
| 2 | |||
| 3 | * progmodes/python.el | ||
| 4 | (python-pdbtrack-comint-output-filter-function): Enhancements on | ||
| 5 | stacktrace detection. (thanks @gnovak) | ||
| 6 | |||
| 1 | 2013-01-30 Glenn Morris <rgm@gnu.org> | 7 | 2013-01-30 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * imenu.el (imenu-default-create-index-function): | 9 | * imenu.el (imenu-default-create-index-function): |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 71c5ba57fa0..2a7a3765ac2 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2317,15 +2317,17 @@ Argument OUTPUT is a string with the output from the comint process." | |||
| 2317 | (file-name | 2317 | (file-name |
| 2318 | (with-temp-buffer | 2318 | (with-temp-buffer |
| 2319 | (insert full-output) | 2319 | (insert full-output) |
| 2320 | (goto-char (point-min)) | 2320 | ;; When the debugger encounters a pdb.set_trace() |
| 2321 | ;; OK, this sucked but now it became a cool hack. The | 2321 | ;; command, it prints a single stack frame. Sometimes |
| 2322 | ;; stacktrace information normally is on the first line | 2322 | ;; it prints a bit of extra information about the |
| 2323 | ;; but in some cases (like when doing a step-in) it is | 2323 | ;; arguments of the present function. When ipdb |
| 2324 | ;; on the second. | 2324 | ;; encounters an exception, it prints the _entire_ stack |
| 2325 | (when (or (looking-at python-pdbtrack-stacktrace-info-regexp) | 2325 | ;; trace. To handle all of these cases, we want to find |
| 2326 | (and | 2326 | ;; the _last_ stack frame printed in the most recent |
| 2327 | (forward-line) | 2327 | ;; batch of output, then jump to the corrsponding |
| 2328 | (looking-at python-pdbtrack-stacktrace-info-regexp))) | 2328 | ;; file/line number. |
| 2329 | (goto-char (point-max)) | ||
| 2330 | (when (re-search-backward python-pdbtrack-stacktrace-info-regexp nil t) | ||
| 2329 | (setq line-number (string-to-number | 2331 | (setq line-number (string-to-number |
| 2330 | (match-string-no-properties 2))) | 2332 | (match-string-no-properties 2))) |
| 2331 | (match-string-no-properties 1))))) | 2333 | (match-string-no-properties 1))))) |