aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorLeo Liu2012-04-26 00:46:01 +0800
committerLeo Liu2012-04-26 00:46:01 +0800
commit784e7d6eebb4ac47d1f7b4e724b7aa843bc02f81 (patch)
tree497df3b8e2f213ce358a4aab7ae337359a976652 /lisp/progmodes/python.el
parentdaf75653c2f1301332eb6c8af830050794ae0877 (diff)
downloademacs-784e7d6eebb4ac47d1f7b4e724b7aa843bc02f81.tar.gz
emacs-784e7d6eebb4ac47d1f7b4e724b7aa843bc02f81.zip
* lisp/progmodes/python.el (python-pdbtrack-get-source-buffer): Use
compilation-message if available to find real filename.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index b00e42db4b7..620ea8cd519 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2606,9 +2606,17 @@ problem."
2606 (let* ((filename (match-string 1 block)) 2606 (let* ((filename (match-string 1 block))
2607 (lineno (string-to-number (match-string 2 block))) 2607 (lineno (string-to-number (match-string 2 block)))
2608 (funcname (match-string 3 block)) 2608 (funcname (match-string 3 block))
2609 (msg (get-text-property 0 'compilation-message filename))
2610 (loc (and msg (compilation--message->loc msg)))
2609 funcbuffer) 2611 funcbuffer)
2610 2612
2611 (cond ((file-exists-p filename) 2613 (cond ((and loc (markerp (compilation--loc->marker loc)))
2614 (setq funcbuffer (marker-buffer (compilation--loc->marker loc)))
2615 (list (with-current-buffer funcbuffer
2616 (line-number-at-pos (compilation--loc->marker loc)))
2617 funcbuffer))
2618
2619 ((file-exists-p filename)
2612 (list lineno (find-file-noselect filename))) 2620 (list lineno (find-file-noselect filename)))
2613 2621
2614 ((setq funcbuffer (python-pdbtrack-grub-for-buffer funcname lineno)) 2622 ((setq funcbuffer (python-pdbtrack-grub-for-buffer funcname lineno))
@@ -2626,15 +2634,12 @@ problem."
2626 (buffer-substring 2634 (buffer-substring
2627 (point-min) (point-max))) 2635 (point-min) (point-max)))
2628 ))))))) 2636 )))))))
2629 (list lineno funcbuffer)) 2637 (list lineno funcbuffer))
2630 2638
2631 ((= (elt filename 0) ?\<) 2639 ((= (elt filename 0) ?\<)
2632 (format "(Non-file source: '%s')" filename)) 2640 (format "(Non-file source: '%s')" filename))
2633 2641
2634 (t (format "Not found: %s(), %s" funcname filename))) 2642 (t (format "Not found: %s(), %s" funcname filename))))))
2635 )
2636 )
2637 )
2638 2643
2639(defun python-pdbtrack-grub-for-buffer (funcname _lineno) 2644(defun python-pdbtrack-grub-for-buffer (funcname _lineno)
2640 "Find recent Python mode buffer named, or having function named FUNCNAME." 2645 "Find recent Python mode buffer named, or having function named FUNCNAME."