changeset 106034:4ff5c9cf147f

* register.el (jump-to-register, insert-register): Handle Semantic tags. From commented-out advice in semantic/senator.el.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 15 Nov 2009 23:54:21 +0000
parents 2bed02fa3041
children 0cbe709e0f55
files lisp/ChangeLog lisp/cedet/semantic/senator.el lisp/register.el
diffstat 3 files changed, 18 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Nov 15 20:28:58 2009 +0000
+++ b/lisp/ChangeLog	Sun Nov 15 23:54:21 2009 +0000
@@ -1,3 +1,8 @@
+2009-11-15  Chong Yidong  <cyd@stupidchicken.com>
+
+	* register.el (jump-to-register, insert-register): Handle Semantic
+	tags.  From commented-out advice in semantic/senator.el.
+
 2009-11-15  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* vc.el (vc-log-show-limit): New variable.
--- a/lisp/cedet/semantic/senator.el	Sun Nov 15 20:28:58 2009 +0000
+++ b/lisp/cedet/semantic/senator.el	Sun Nov 15 23:54:21 2009 +0000
@@ -857,26 +857,6 @@
 ;;   [(control ?,)]
 ;;   'senator-isearch-toggle-semantic-mode)
 
-;; (defadvice insert-register (around senator activate)
-;;   "Insert contents of register REGISTER as a tag.
-;; If senator is not active, use the original mechanism."
-;;   (let ((val (get-register (ad-get-arg 0))))
-;;     (if (and senator-minor-mode (interactive-p)
-;;              (semantic-foreign-tag-p val))
-;;         (semantic-insert-foreign-tag val)
-;;       ad-do-it)))
-
-;; (defadvice jump-to-register (around senator activate)
-;;   "Insert contents of register REGISTER as a tag.
-;; If senator is not active, use the original mechanism."
-;;   (let ((val (get-register (ad-get-arg 0))))
-;;     (if (and senator-minor-mode (interactive-p)
-;;              (semantic-foreign-tag-p val))
-;;         (progn
-;;           (switch-to-buffer (semantic-tag-buffer val))
-;;           (goto-char (semantic-tag-start val)))
-;;       ad-do-it)))
-
 (provide 'semantic/senator)
 
 ;; Local variables:
--- a/lisp/register.el	Sun Nov 15 20:28:58 2009 +0000
+++ b/lisp/register.el	Sun Nov 15 23:54:21 2009 +0000
@@ -28,6 +28,10 @@
 ;; pieces of buffer state to named variables.  The entry points are
 ;; documented in the Emacs user's manual.
 
+(declare-function semantic-insert-foreign-tag "semantic/tag" (foreign-tag))
+(declare-function semantic-tag-buffer "semantic/tag" (tag))
+(declare-function semantic-tag-start "semantic/tag" (tag))
+
 ;;; Global key bindings
 
 (define-key ctl-x-r-map "\C-@" 'point-to-register)
@@ -135,6 +139,11 @@
 	  (error "Register access aborted"))
       (find-file (nth 1 val))
       (goto-char (nth 2 val)))
+     ((and (fboundp 'semantic-foreign-tag-p)
+	   semantic-mode
+	   (semantic-foreign-tag-p val))
+      (switch-to-buffer (semantic-tag-buffer val))
+      (goto-char (semantic-tag-start val)))
      (t
       (error "Register doesn't contain a buffer position or configuration")))))
 
@@ -284,6 +293,10 @@
       (princ val (current-buffer)))
      ((and (markerp val) (marker-position val))
       (princ (marker-position val) (current-buffer)))
+     ((and (fboundp 'semantic-foreign-tag-p)
+	   semantic-mode
+	   (semantic-foreign-tag-p val))
+      (semantic-insert-foreign-tag val))
      (t
       (error "Register does not contain text"))))
   (if (not arg) (exchange-point-and-mark)))