]> git.eshelyaron.com Git - emacs.git/commitdiff
In xref-location-marker, handle deleted file or outdated xref location nicely
authorStephen Leake <stephen_leake@stephe-leake.org>
Sun, 20 Oct 2019 13:39:02 +0000 (06:39 -0700)
committerStephen Leake <stephen_leake@stephe-leake.org>
Sun, 20 Oct 2019 13:39:02 +0000 (06:39 -0700)
* lisp/progmodes/xref.el (xref-location-marker): Add ignore-errors.

lisp/progmodes/xref.el

index 702de894528f70b92845eb6930367b99a9b4f7b9..8d8e7ab208e041a2b5224656d7203e5e7451fea6 100644 (file)
@@ -131,8 +131,13 @@ Line numbers start from 1 and columns from 0.")
         (widen)
         (save-excursion
           (goto-char (point-min))
-          (beginning-of-line line)
-          (forward-char column)
+          (ignore-errors
+            ;; xref location may be out of date; it may be past the
+            ;; end of the current file, or the file may have been
+            ;; deleted. Return a reasonable location; the user will
+            ;; figure it out.
+            (beginning-of-line line)
+            (forward-char column))
           (point-marker))))))
 
 (cl-defmethod xref-location-group ((l xref-file-location))