From: Ken Manheimer Date: Sun, 20 Sep 2015 01:34:36 +0000 (-0400) Subject: Repair pdbtrack so it follows transition from one remote file to another. X-Git-Tag: emacs-25.0.90~1224^2~76 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=89898fcd83db040923a2d454e849bfcc0f463bd4;p=emacs.git Repair pdbtrack so it follows transition from one remote file to another. * python.el (python-pdbtrack-set-tracked-buffer). --- diff --git a/lisp/ChangeLog.17 b/lisp/ChangeLog.17 index a40f8f3d67a..224e2a6da7f 100644 --- a/lisp/ChangeLog.17 +++ b/lisp/ChangeLog.17 @@ -1,3 +1,8 @@ +2015-09-20 Ken Manheimer + + * python.el (python-pdbtrack-set-tracked-buffer): Repair pdbtrack + so it follows transition from one remote file to another. + 2015-04-06 Alan Mackenzie Fix miscellaneous glitches in cc-mode.el. (Bug#20245) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9528ffeebbc..243125e310c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3635,12 +3635,18 @@ Never set this variable directly, use "Set the buffer for FILE-NAME as the tracked buffer. Internally it uses the `python-pdbtrack-tracked-buffer' variable. Returns the tracked buffer." - (let ((file-buffer (get-file-buffer - (concat (file-remote-p default-directory) - file-name)))) + (let* ((file-name-prospect (concat (file-remote-p default-directory) + file-name)) + (file-buffer (get-file-buffer file-name-prospect))) (if file-buffer (setq python-pdbtrack-tracked-buffer file-buffer) - (setq file-buffer (find-file-noselect file-name)) + (cond + ((file-exists-p file-name-prospect) + (setq file-buffer (find-file-noselect file-name-prospect))) + ((and (not (equal file-name file-name-prospect)) + (file-exists-p file-name)) + ;; Fallback to a locally available copy of the file. + (setq file-buffer (find-file-noselect file-name-prospect)))) (when (not (member file-buffer python-pdbtrack-buffers-to-kill)) (add-to-list 'python-pdbtrack-buffers-to-kill file-buffer))) file-buffer))