From 4cf1d7e39cfd52b756005bafdbeeaa49109887ef Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 15 Nov 2009 23:54:21 +0000 Subject: [PATCH] * register.el (jump-to-register, insert-register): Handle Semantic tags. From commented-out advice in semantic/senator.el. --- lisp/ChangeLog | 5 +++++ lisp/cedet/semantic/senator.el | 20 -------------------- lisp/register.el | 13 +++++++++++++ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 876e48db9fd..6dac08e6c56 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2009-11-15 Chong Yidong + + * register.el (jump-to-register, insert-register): Handle Semantic + tags. From commented-out advice in semantic/senator.el. + 2009-11-15 Dan Nicolaescu * vc.el (vc-log-show-limit): New variable. diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el index 522b655c208..d9dda249957 100644 --- a/lisp/cedet/semantic/senator.el +++ b/lisp/cedet/semantic/senator.el @@ -857,26 +857,6 @@ Use a senator search function when semantic isearch mode is enabled." ;; [(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: diff --git a/lisp/register.el b/lisp/register.el index 4144bba7d0b..2800fd96ee3 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -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 @@ delete any existing frames that the frame configuration doesn't mention. (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 @@ Interactively, second arg is non-nil if prefix arg is supplied." (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))) -- 2.39.2