aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2016-05-05 04:28:14 +0300
committerDmitry Gutov2016-05-05 04:28:14 +0300
commit1a4127dbd625ea64f535b3bd09844a99161290a6 (patch)
tree41107e72880c4377b06f2505f3d2475ae7dc2151
parentab3ba912fc7b91b7b147ea36fabe461dc99a9fb8 (diff)
downloademacs-1a4127dbd625ea64f535b3bd09844a99161290a6.tar.gz
emacs-1a4127dbd625ea64f535b3bd09844a99161290a6.zip
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.
-rw-r--r--lisp/progmodes/elisp-mode.el5
-rw-r--r--lisp/progmodes/etags.el5
2 files changed, 6 insertions, 4 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index fc4501d0cbe..6c6c3803f9e 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
826 (pcase-let (((cl-struct xref-elisp-location symbol type file) l)) 826 (pcase-let (((cl-struct xref-elisp-location symbol type file) l))
827 (let ((buffer-point (find-function-search-for-symbol symbol type file))) 827 (let ((buffer-point (find-function-search-for-symbol symbol type file)))
828 (with-current-buffer (car buffer-point) 828 (with-current-buffer (car buffer-point)
829 (goto-char (or (cdr buffer-point) (point-min))) 829 (save-excursion
830 (point-marker))))) 830 (goto-char (or (cdr buffer-point) (point-min)))
831 (point-marker))))))
831 832
832(cl-defmethod xref-location-group ((l xref-elisp-location)) 833(cl-defmethod xref-location-group ((l xref-elisp-location))
833 (xref-elisp-location-file l)) 834 (xref-elisp-location-file l))
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index a2a0df2d6e1..890d55294cf 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2146,8 +2146,9 @@ for \\[find-tag] (which see)."
2146 (with-slots (tag-info file) l 2146 (with-slots (tag-info file) l
2147 (let ((buffer (find-file-noselect file))) 2147 (let ((buffer (find-file-noselect file)))
2148 (with-current-buffer buffer 2148 (with-current-buffer buffer
2149 (etags-goto-tag-location tag-info) 2149 (save-excursion
2150 (point-marker))))) 2150 (etags-goto-tag-location tag-info)
2151 (point-marker))))))
2151 2152
2152(cl-defmethod xref-location-line ((l xref-etags-location)) 2153(cl-defmethod xref-location-line ((l xref-etags-location))
2153 (with-slots (tag-info) l 2154 (with-slots (tag-info) l