emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108033: * lisp/progmodes/python.el (


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108033: * lisp/progmodes/python.el (python-pdbtrack-get-source-buffer): Use
Date: Thu, 26 Apr 2012 00:46:01 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 108033
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Thu 2012-04-26 00:46:01 +0800
message:
  * lisp/progmodes/python.el (python-pdbtrack-get-source-buffer): Use
  compilation-message if available to find real filename.
modified:
  lisp/ChangeLog
  lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-25 15:23:19 +0000
+++ b/lisp/ChangeLog    2012-04-25 16:46:01 +0000
@@ -1,3 +1,8 @@
+2012-04-25  Leo Liu  <address@hidden>
+
+       * progmodes/python.el (python-pdbtrack-get-source-buffer): Use
+       compilation-message if available to find real filename.
+
 2012-04-25  Chong Yidong  <address@hidden>
 
        * vc/diff-mode.el (diff-setup-whitespace): New function.

=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el  2012-04-25 15:23:19 +0000
+++ b/lisp/progmodes/python.el  2012-04-25 16:46:01 +0000
@@ -2606,9 +2606,17 @@
     (let* ((filename (match-string 1 block))
            (lineno (string-to-number (match-string 2 block)))
            (funcname (match-string 3 block))
+           (msg (get-text-property 0 'compilation-message filename))
+           (loc (and msg (compilation--message->loc msg)))
            funcbuffer)
 
-      (cond ((file-exists-p filename)
+      (cond ((and loc (markerp (compilation--loc->marker loc)))
+             (setq funcbuffer (marker-buffer (compilation--loc->marker loc)))
+             (list (with-current-buffer funcbuffer
+                     (line-number-at-pos (compilation--loc->marker loc)))
+                   funcbuffer))
+
+            ((file-exists-p filename)
              (list lineno (find-file-noselect filename)))
 
             ((setq funcbuffer (python-pdbtrack-grub-for-buffer funcname 
lineno))
@@ -2626,15 +2634,12 @@
                                                   (buffer-substring
                                                    (point-min) (point-max)))
                                     )))))))
-               (list lineno funcbuffer))
+             (list lineno funcbuffer))
 
             ((= (elt filename 0) ?\<)
              (format "(Non-file source: '%s')" filename))
 
-            (t (format "Not found: %s(), %s" funcname filename)))
-      )
-    )
-  )
+            (t (format "Not found: %s(), %s" funcname filename))))))
 
 (defun python-pdbtrack-grub-for-buffer (funcname _lineno)
   "Find recent Python mode buffer named, or having function named FUNCNAME."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]