emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 1a4127d: Use save-excursion in xref-location-mark


From: Dmitry Gutov
Subject: [Emacs-diffs] emacs-25 1a4127d: Use save-excursion in xref-location-marker more
Date: Thu, 05 May 2016 01:28:29 +0000

branch: emacs-25
commit 1a4127dbd625ea64f535b3bd09844a99161290a6
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Use save-excursion in xref-location-marker more
    
    * lisp/progmodes/elisp-mode.el (xref-location-marker): Use
    save-excursion, in order not to alter the value of point if the
    buffer is currently open in the background (problem reported by
    Robert Weiner).
    
    * lisp/progmodes/etags.el (xref-location-marker): Same.
---
 lisp/progmodes/elisp-mode.el |    5 +++--
 lisp/progmodes/etags.el      |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index fc4501d..6c6c380 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -826,8 +826,9 @@ non-nil result supercedes the xrefs produced by
   (pcase-let (((cl-struct xref-elisp-location symbol type file) l))
     (let ((buffer-point (find-function-search-for-symbol symbol type file)))
       (with-current-buffer (car buffer-point)
-        (goto-char (or (cdr buffer-point) (point-min)))
-        (point-marker)))))
+        (save-excursion
+          (goto-char (or (cdr buffer-point) (point-min)))
+          (point-marker))))))
 
 (cl-defmethod xref-location-group ((l xref-elisp-location))
   (xref-elisp-location-file l))
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index a2a0df2..890d552 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2146,8 +2146,9 @@ for \\[find-tag] (which see)."
   (with-slots (tag-info file) l
     (let ((buffer (find-file-noselect file)))
       (with-current-buffer buffer
-        (etags-goto-tag-location tag-info)
-        (point-marker)))))
+        (save-excursion
+          (etags-goto-tag-location tag-info)
+          (point-marker))))))
 
 (cl-defmethod xref-location-line ((l xref-etags-location))
   (with-slots (tag-info) l



reply via email to

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