Subject: 25.0.95; CEDET should use xref marker stack when jumping

From: Bastian Beischer <[email-masked]>
Date: Sat, 18 Jun 2016 12:55:06 +0200

CEDET / Semantic should use xref-push-marker-stack when jumping to a
tag, this makes it easy to pop back to the original place.

Patch for Emacs 25.0.95 is attached - but maybe there are more places
that need fixing? There's also the option to put this in
semantic-go-to-tag directly.

diff --git a/lisp/cedet/semantic/analyze/refs.el b/lisp/cedet/semantic/analyze/refs.el
index f876827..1087dbd 100644
--- a/lisp/cedet/semantic/analyze/refs.el
+++ b/lisp/cedet/semantic/analyze/refs.el
@@ -347,6 +347,8 @@ semantic-analyze-proto-impl-toggle
 	     (if (semantic-tag-prototype-p tag) "implementation" "prototype")))
 
     (push-mark)
+    (when (fboundp 'xref-push-marker-stack)
+      (xref-push-marker-stack))
     (semantic-go-to-tag target)
     (switch-to-buffer (current-buffer))
     (semantic-momentary-highlight-tag target))
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index de76232..825ca8d 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -2105,6 +2105,8 @@ semantic-complete-jump-local
   (let ((tag (semantic-complete-read-tag-buffer-deep "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (push-mark)
+      (when (fboundp 'xref-push-marker-stack)
+        (xref-push-marker-stack))
       (goto-char (semantic-tag-start tag))
       (semantic-momentary-highlight-tag tag)
       (message "%S: %s "
@@ -2119,6 +2121,8 @@ semantic-complete-jump
   (let* ((tag (semantic-complete-read-tag-project "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (push-mark)
+      (when (fboundp 'xref-push-marker-stack)
+        (xref-push-marker-stack))
       (semantic-go-to-tag tag)
       (switch-to-buffer (current-buffer))
       (semantic-momentary-highlight-tag tag)
@@ -2138,6 +2142,8 @@ semantic-complete-jump-local-members
 	(unless start
 	  (error "Tag %s has no location" (semantic-format-tag-prototype tag)))
 	(push-mark)
+        (when (fboundp 'xref-push-marker-stack)
+          (xref-push-marker-stack))
 	(goto-char start)
 	(semantic-momentary-highlight-tag tag)
 	(message "%S: %s "
diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el
index 214fbb5..562d3cf 100644
--- a/lisp/cedet/semantic/ia.el
+++ b/lisp/cedet/semantic/ia.el
@@ -316,8 +316,8 @@ semantic-ia--fast-jump-helper
   ;; 1) Push the mark, so you can pop global mark back, or
   ;;    use semantic-mru-bookmark mode to do so.
   (push-mark)
-  (when (fboundp 'push-tag-mark)
-    (push-tag-mark))
+  (when (fboundp 'xref-push-marker-stack)
+    (xref-push-marker-stack))
   ;; 2) Visits the tag.
   (semantic-go-to-tag dest)
   ;; 3) go-to-tag doesn't switch the buffer in the current window,
@@ -385,8 +385,8 @@ semantic-ia-fast-jump
       ;; Push the mark, so you can pop global mark back, or
       ;; use semantic-mru-bookmark mode to do so.
       (push-mark)
-      (when (fboundp 'push-tag-mark)
-	(push-tag-mark))
+      (when (fboundp 'xref-push-marker-stack)
+	(xref-push-marker-stack))
 
       (semantic-decoration-include-visit)
       )
diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el
index 38abc9e..39ab639 100644
--- a/lisp/cedet/semantic/senator.el
+++ b/lisp/cedet/semantic/senator.el
@@ -526,6 +526,8 @@ senator-go-to-up-reference
     (if (not result)
         (error "No up reference found")
       (push-mark)
+      (when (fboundp 'xref-push-marker-stack)
+        (xref-push-marker-stack))
       (cond
        ;; A tag
        ((semantic-tag-p result)