diff Misc/python-mode.el @ 29518:05fb51d07ada legacy-trunk

Remove short-circuitying grubbing by using last grubbed buffer. It's evil - if the last grubbed buffer didn't happen to be the right one, you couldn't remedy. Mainline emacs compat - don't use third arg to buffer-substring (which was for explicitly identifying the buffer in which to seek the substring, and which turns out to be unnecessary).
author Ken Manheimer <klm@digicool.com>
date Tue, 17 Jun 2003 19:18:57 +0000
parents f2c74cfea051
children d72547c915d5
line wrap: on
line diff
--- a/Misc/python-mode.el	Tue Jun 17 16:53:25 2003 +0000
+++ b/Misc/python-mode.el	Tue Jun 17 19:18:57 2003 +0000
@@ -1370,8 +1370,7 @@
                              (max (point-min)
                                   (string-match "^\\([^#]\\|#[^#]\\|#$\\)"
                                                 (buffer-substring (point-min)
-                                                                  (point-max)
-                                                                  funcbuffer))
+                                                                  (point-max)))
                                   ))))))
              (list lineno funcbuffer))
 
@@ -1392,10 +1391,6 @@
   (let ((buffers (buffer-list))
         curbuf
         got)
-    (if (and py-pdbtrack-last-grubbed-buffer
-             (member py-pdbtrack-last-grubbed-buffer buffers))
-        ; Prefer last grubbed buffer by putting it at the front of the list:
-        (setq buffers (cons py-pdbtrack-last-grubbed-buffer buffers)))
     (while (and buffers (not got))
       (setq buf (car buffers)
             buffers (cdr buffers))
@@ -1404,9 +1399,10 @@
                (or (string-match funcname (buffer-name buf))
                    (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+"
                                          funcname "\\s-*(")
-                                 (buffer-substring (point-min buf)
-                                                   (point-max buf)
-                                                   buf))))
+                                 (save-excursion
+                                   (set-buffer buf)
+                                   (buffer-substring (point-min)
+                                                     (point-max))))))
           (setq got buf)))
     (setq py-pdbtrack-last-grubbed-buffer got)))