Hi Eric,
Maybe you remember it, several months ago we have a discussion about a
more flexible implementation of the foreign tag mechanism in semantic.
I proposed a first implementation I never committed because of lack of
time to complete it and probably because of other things to do ;-)
I finally got some time to complete the implementation to take into
account some of your remarks and I submit you the final patch below. I
did some copy/yank of tags between Elisp and Texi buffers (which is
the main use of foreign tags) and that seems to work well.
I know you're busy these days, however it would be nice if you could
have a look at this patch (which also fixes context overrides in
semantic-grammar.el).
Also, do you think I can commit these changes before the release?
Thanks.
David
2005-09-20 David Ponce <david@...>
=09* cedet/semantic/document.el
=09(document-massage-to-texinfo): Use `semantic-tag-mode'.
=09
=09* cedet/semantic/semantic-ctxt.el
=09(semantic-ctxt-current-mode)
=09(semantic-ctxt-current-mode-default): New functions.
=09* cedet/semantic/semantic-grammar.el
=09(semantic-ctxt-current-function)
=09(semantic-ctxt-current-argument)
=09(semantic-ctxt-current-assignment)
=09(semantic-ctxt-current-class-list): Take into account the optional
=09argument POINT.
=09(semantic-ctxt-current-mode): New function.
=09* cedet/semantic/semantic-tag.el
=09(semantic-tag-buffer): Handle tag with an originating file.
=09(semantic-tag-mode)
=09(semantic-foreign-tag-invalid, semantic-foreign-tag-p)
=09(semantic-foreign-tag-check, semantic-foreign-tag)
=09(semantic-obtain-foreign-tag): New functions.
=09(semantic-insert-foreign-tag-default)
=09(semantic-insert-foreign-tag): Move from senator.el. Change
=09arguments.
=09* cedet/semantic/semantic-texi.el
=09(semantic-insert-foreign-tag): Receive a foreign tag. Use
=09`semantic-tag-buffer'.
=09* cedet/semantic/senator.el
=09(semantic-insert-foreign-tag-default)
=09(semantic-insert-foreign-tag): Move to semantic-tag.el.
=09(senator-copy-tag, senator-yank-tag)
=09(senator-copy-tag-to-register)
=09(insert-register, jump-to-register): Use foreign tags.
Index: semantic/document.el
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/cedet/cedet/semantic/document.el,v
retrieving revision 1.25
diff -c -r1.25 document.el
*** semantic/document.el=0919 Mar 2004 23:36:11 -0000=091.25
--- semantic/document.el=0920 Sep 2005 14:12:50 -0000
***************
*** 772,796 ****
(defun document-massage-to-texinfo (tag buffer string)
"Massage TAG's documentation from BUFFER as STRING.
This is to take advantage of TeXinfo's markup symbols."
! (if (save-excursion (set-buffer buffer)
! =09=09 (eq major-mode 'emacs-lisp-mode))
;; Elisp has a few advantages. Hack it in.
(setq string (document-texify-elisp-docstring string)))
! ;; Else, other languages are simpler. Also, might as well
! ;; run the elisp version through also.
! (let ((case-fold-search nil)
! =09(start 0))
! (while (string-match
! =09 "\\(^\\|[^{]\\)\\<\\([A-Z0-9_-]+\\)\\>\\($\\|[^}]\\)"
! =09 string start)
! (setq string (concat (substring string 0 (match-beginning 2))
! =09=09=09 "@var{"
! =09=09=09 (downcase (match-string 2 string))
! =09=09=09 "}"
! =09=09=09 (substring string (match-end 2)))
! =09 start (match-end 2)))
! )
! string)
=20
;; This FN was taken from EIEIO and modified. Maybe convert later.
(defun document-texify-elisp-docstring (string)
--- 772,798 ----
(defun document-massage-to-texinfo (tag buffer string)
"Massage TAG's documentation from BUFFER as STRING.
This is to take advantage of TeXinfo's markup symbols."
! (let ((mode (with-current-buffer buffer (semantic-tag-mode tag))))
! (when (eq mode 'emacs-lisp-mode)
;; Elisp has a few advantages. Hack it in.
(setq string (document-texify-elisp-docstring string)))
! ;; Else, other languages are simpler. Also, might as well
! ;; run the elisp version through also.
! (let ((case-fold-search nil)
! (start 0))
! (while (string-match
! "\\(^\\|[^{]\\)\\<\\([A-Z0-9_-]+\\)\\>\\($\\|[^}]\\)"
! string start)
! (setq string (concat (substring string 0 (match-beginning 2))
! "@var{"
! (if (eq mode 'emacs-lisp-mode)
! (downcase (match-string 2 string))
! (match-string 2 string))
! "}"
! (substring string (match-end 2)))
! start (match-end 2)))
! )
! string))
=20
;; This FN was taken from EIEIO and modified. Maybe convert later.
(defun document-texify-elisp-docstring (string)
Index: semantic/semantic-ctxt.el
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/cedet/cedet/semantic/semantic-ctxt.el,v
retrieving revision 1.38
diff -c -r1.38 semantic-ctxt.el
*** semantic/semantic-ctxt.el=0930 Jun 2005 01:20:54 -0000=091.38
--- semantic/semantic-ctxt.el=0920 Sep 2005 14:12:50 -0000
***************
*** 475,480 ****
--- 475,491 ----
=09 '(type))
=09 (t nil))))))
=20
+ (define-overload semantic-ctxt-current-mode (&optional point)
+ "Return the major mode active at POINT.
+ POINT defaults to the value of point in current buffer.
+ You should override this function in multiple mode buffers to
+ determine which major mode apply at point.")
+=20
+ (defun semantic-ctxt-current-mode-default (&optional point)
+ "Return the major mode active at POINT.
+ POINT defaults to the value of point in current buffer.
+ This default implementation returns the current major mode."
+ major-mode)
=0C
;;; Scoped Types
;;
Index: semantic/semantic-grammar.el
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/cedet/cedet/semantic/semantic-grammar.el,v
retrieving revision 1.68
diff -c -r1.68 semantic-grammar.el
*** semantic/semantic-grammar.el=0930 Jun 2005 01:31:05 -0000=091.68
--- semantic/semantic-grammar.el=0920 Sep 2005 14:12:50 -0000
***************
*** 1686,1723 ****
(define-mode-local-override semantic-ctxt-current-function
semantic-grammar-mode (&optional point)
"Determine the name of the current function at POINT."
! (if (semantic-grammar-in-lisp-p)
(with-mode-local emacs-lisp-mode
! =09(semantic-ctxt-current-function point))
! nil
! ))
=20
(define-mode-local-override semantic-ctxt-current-argument
semantic-grammar-mode (&optional point)
"Determine the argument index of the called function at POINT."
! (if (semantic-grammar-in-lisp-p)
(with-mode-local emacs-lisp-mode
! =09(semantic-ctxt-current-argument point))
! nil
! ))
=20
(define-mode-local-override semantic-ctxt-current-assignment
semantic-grammar-mode (&optional point)
"Determine the tag being assigned into at POINT."
! (if (semantic-grammar-in-lisp-p)
(with-mode-local emacs-lisp-mode
! =09(semantic-ctxt-current-assignment point))
! nil
! ))
=20
(define-mode-local-override semantic-ctxt-current-class-list
semantic-grammar-mode (&optional point)
"Determine the class of tags that can be used at POINT."
! (if (semantic-grammar-in-lisp-p)
! (with-mode-local emacs-lisp-mode
! =09(semantic-ctxt-current-class-list point))
! '(nonterminal keyword)
! ))
=20
(define-mode-local-override semantic-format-tag-abbreviate
semantic-grammar-mode (tag &optional parent color)
--- 1686,1736 ----
(define-mode-local-override semantic-ctxt-current-function
semantic-grammar-mode (&optional point)
"Determine the name of the current function at POINT."
! (save-excursion
! (and point (goto-char point))
! (when (semantic-grammar-in-lisp-p)
(with-mode-local emacs-lisp-mode
! (semantic-ctxt-current-function)))))
=20
(define-mode-local-override semantic-ctxt-current-argument
semantic-grammar-mode (&optional point)
"Determine the argument index of the called function at POINT."
! (save-excursion
! (and point (goto-char point))
! (when (semantic-grammar-in-lisp-p)
(with-mode-local emacs-lisp-mode
! (semantic-ctxt-current-argument)))))
=20
(define-mode-local-override semantic-ctxt-current-assignment
semantic-grammar-mode (&optional point)
"Determine the tag being assigned into at POINT."
! (save-excursion
! (and point (goto-char point))
! (when (semantic-grammar-in-lisp-p)
(with-mode-local emacs-lisp-mode
! (semantic-ctxt-current-assignment)))))
=20
(define-mode-local-override semantic-ctxt-current-class-list
semantic-grammar-mode (&optional point)
"Determine the class of tags that can be used at POINT."
! (save-excursion
! (and point (goto-char point))
! (if (semantic-grammar-in-lisp-p)
! (with-mode-local emacs-lisp-mode
! (semantic-ctxt-current-class-list))
! '(nonterminal keyword))))
!=20
! (define-mode-local-override semantic-ctxt-current-mode
! semantic-grammar-mode (&optional point)
! "Return the major mode active at POINT.
! POINT defaults to the value of point in current buffer.
! Return `emacs-lisp-mode' is POINT is within Lisp code, otherwise
! return the current major mode."
! (save-excursion
! (and point (goto-char point))
! (if (semantic-grammar-in-lisp-p)
! 'emacs-lisp-mode
! (semantic-ctxt-current-mode-default))))
=20
(define-mode-local-override semantic-format-tag-abbreviate
semantic-grammar-mode (tag &optional parent color)
Index: semantic/semantic-tag.el
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/cedet/cedet/semantic/semantic-tag.el,v
retrieving revision 1.36
diff -c -r1.36 semantic-tag.el
*** semantic/semantic-tag.el=0926 Aug 2005 20:30:52 -0000=091.36
--- semantic/semantic-tag.el=0920 Sep 2005 14:12:51 -0000
***************
*** 144,156 ****
(semantic-overlay-move o start end)
(semantic--tag-set-overlay tag (vector start end)))))
=20
! (defsubst semantic-tag-buffer (tag)
"Return the buffer TAG resides in.
Return nil if there is no buffer for this tag."
(let ((o (semantic-tag-overlay tag)))
! (and (semantic-overlay-p o)
! (semantic-overlay-live-p o)
! (semantic-overlay-buffer o))))
=20
(defsubst semantic--tag-attributes-cdr (tag)
"Return the cons cell whose car is the ATTRIBUTES part of TAG.
--- 144,187 ----
(semantic-overlay-move o start end)
(semantic--tag-set-overlay tag (vector start end)))))
=20
! (defun semantic-tag-buffer (tag)
"Return the buffer TAG resides in.
+ If TAG has an originating file, read that file into a (maybe new)
+ buffer, and return it.
Return nil if there is no buffer for this tag."
(let ((o (semantic-tag-overlay tag)))
! (cond
! ;; TAG is currently linked to a buffer, return it.
! ((and (semantic-overlay-p o)
! (semantic-overlay-live-p o))
! (semantic-overlay-buffer o))
! ;; TAG has an originating file, read that file into a buffer, and
! ;; return it.
! ((semantic--tag-get-property tag :filename)
! (find-file-noselect (semantic--tag-get-property tag :filename)))
! ;; TAG is not in Emacs right now, no buffer is available.
! )))
!=20
! (defun semantic-tag-mode (&optional tag)
! "Return the major mode active for TAG.
! TAG defaults to the tag at point in current buffer.
! If TAG has a :mode property return it.
! If point is inside TAG bounds, return the major mode active at point.
! Return the major mode active at beginning of TAG otherwise.
! See also the function `semantic-ctxt-current-mode'."
! (or tag (setq tag (semantic-current-tag)))
! (or (semantic--tag-get-property tag :mode)
! (let ((buffer (semantic-tag-buffer tag))
! (start (semantic-tag-start tag))
! (end (semantic-tag-end tag)))
! (save-excursion
! (and buffer (set-buffer buffer))
! ;; Unless point is inside TAG bounds, move it to the
! ;; beginning of TAG.
! (or (and (>=3D (point) start) (< (point) end))
! (goto-char start))
! (require 'semantic-ctxt)
! (semantic-ctxt-current-mode)))))
=20
(defsubst semantic--tag-attributes-cdr (tag)
"Return the cons cell whose car is the ATTRIBUTES part of TAG.
***************
*** 705,711 ****
(if positiononly
(semantic-tag-components-with-overlays tag)
(semantic-tag-components tag)))
-=20
=0C
;;; Tag Region
;;
--- 736,741 ----
***************
*** 737,743 ****
=09 (lambda ()
=09 (def-edebug-spec semantic-with-buffer-narrowed-to-tag
=09 (def-body))))
-=20
=0C
;;; Tag Hooks
;;
--- 767,772 ----
***************
*** 937,952 ****
(list tag))
(list tag))))
=0C
;;; EDEBUG display support
;;
(eval-after-load "cedet-edebug"
'(progn
! (cedet-edebug-add-print-override '(semantic-tag-p object)
! =09=09=09=09 '(concat "#<TAG " (semantic-format-tag-name object) ">"=
))
! (cedet-edebug-add-print-override '(and (listp object) (semantic-tag-=
p (car object)))
! =09=09=09=09 '(cedet-edebug-prin1-recurse object) )
))
-=20
=0C
;;; Compatibility
;;
--- 966,1041 ----
(list tag))
(list tag))))
=0C
+ ;; Foreign tags
+ ;;
+ (defmacro semantic-foreign-tag-invalid (tag)
+ "Signal that TAG is an invalid foreign tag."
+ `(signal 'wrong-type-argument '(semantic-foreign-tag-p ,tag)))
+=20
+ (defsubst semantic-foreign-tag-p (tag)
+ "Return non-nil if TAG is a foreign tag.
+ That is, a tag unlinked from the originating buffer, which carries the
+ originating buffer file name, and major mode."
+ (and (semantic-tag-p tag)
+ (semantic--tag-get-property tag :foreign-flag)))
+=20
+ (defsubst semantic-foreign-tag-check (tag)
+ "Check that TAG is a valid foreign tag.
+ Signal an error if not."
+ (or (semantic-foreign-tag-p tag)
+ (semantic-foreign-tag-invalid tag)))
+=20
+ (defun semantic-foreign-tag (&optional tag)
+ "Return a copy of TAG as a foreign tag, or nil if it can't be done.
+ TAG defaults to the tag at point in current buffer.
+ See also `semantic-foreign-tag-p'."
+ (or tag (setq tag (semantic-current-tag)))
+ (when (semantic-tag-p tag)
+ (let ((ftag (semantic-tag-copy tag nil t)))
+ ;; A foreign tag must carry its originating buffer file name!
+ (when (semantic--tag-get-property ftag :filename)
+ (semantic--tag-put-property
+ ftag :mode (semantic-tag-mode tag))
+ (semantic--tag-put-property ftag :foreign-flag t)
+ ftag))))
+=20
+ ;; High level obtain/insert foreign tag overloads
+ ;;
+ ;;;###autoload
+ (define-overload semantic-obtain-foreign-tag (&optional tag)
+ "Obtain a foreign tag from TAG.
+ TAG defaults to the tag at point in current buffer.
+ Return the obtained foreign tag or nil if failed."
+ (semantic-foreign-tag tag))
+=20
+ (defun semantic-insert-foreign-tag-default (foreign-tag)
+ "Insert FOREIGN-TAG into the current buffer.
+ The default behavior assumes the current buffer is a language file,
+ and attempts to insert a prototype/function call."
+ ;; Long term goal: Have a mechanism for a tempo-like template insert
+ ;; for the given tag.
+ (insert (semantic-format-tag-prototype foreign-tag)))
+=20
+ ;;;###autoload
+ (define-overload semantic-insert-foreign-tag (foreign-tag)
+ "Insert FOREIGN-TAG into the current buffer.
+ Signal an error if FOREIGN-TAG is not a valid foreign tag.
+ This function is overridable with the symbol `insert-foreign-tag'."
+ (semantic-foreign-tag-check foreign-tag)
+ (:override)
+ (message (semantic-format-tag-summarize foreign-tag)))
+ =0C
;;; EDEBUG display support
;;
(eval-after-load "cedet-edebug"
'(progn
! (cedet-edebug-add-print-override
! '(semantic-tag-p object)
! '(concat "#<TAG " (semantic-format-tag-name object) ">"))
! (cedet-edebug-add-print-override
! '(and (listp object) (semantic-tag-p (car object)))
! '(cedet-edebug-prin1-recurse object))
))
=0C
;;; Compatibility
;;
Index: semantic/semantic-texi.el
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/cedet/cedet/semantic/semantic-texi.el,v
retrieving revision 1.31
diff -c -r1.31 semantic-texi.el
*** semantic/semantic-texi.el=0916 Jan 2005 22:04:00 -0000=091.31
--- semantic/semantic-texi.el=0920 Sep 2005 14:12:51 -0000
***************
*** 222,236 ****
(semantic-tag-get-attribute tag :members))
=20
(define-mode-local-override semantic-insert-foreign-tag
! texinfo-mode (tag tagfile)
"Insert TAG from a foreign buffer in TAGFILE.
Assume TAGFILE is a source buffer, and create a documentation
thingy from it using the `document' tool."
;; This makes sure that TAG will be in an active buffer.
! (let ((b (find-file-noselect tagfile)))
;; Now call the document insert thingy.
(require 'document)
! (document-insert-texinfo tag b)))
=20
=20
(define-mode-local-override semantic-ctxt-current-class-list
--- 222,236 ----
(semantic-tag-get-attribute tag :members))
=20
(define-mode-local-override semantic-insert-foreign-tag
! texinfo-mode (foreign-tag)
"Insert TAG from a foreign buffer in TAGFILE.
Assume TAGFILE is a source buffer, and create a documentation
thingy from it using the `document' tool."
;; This makes sure that TAG will be in an active buffer.
! (let ((b (semantic-tag-buffer foreign-tag)))
;; Now call the document insert thingy.
(require 'document)
! (document-insert-texinfo foreign-tag b)))
=20
=20
(define-mode-local-override semantic-ctxt-current-class-list
Index: semantic/senator.el
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/cedet/cedet/semantic/senator.el,v
retrieving revision 1.108
diff -c -r1.108 senator.el
*** semantic/senator.el=091 Sep 2005 00:11:55 -0000=091.108
--- semantic/senator.el=0920 Sep 2005 14:12:52 -0000
***************
*** 2461,2486 ****
(defvar senator-tag-ring (make-ring 20)
"Ring of tags for use with cut and paste.")
=20
- (defun semantic-insert-foreign-tag-default (tag tagfile)
- "Insert TAG from a foreign buffer into the current buffer.
- This is the default behavior for `semantic-insert-foreign-tag'.
- Assumes the current buffer is a language file, and attempts to insert
- a prototype/function call.
- Argument TAGFILE is the file from wence TAG came."
- ;; Long term goal:
- ;; Have a mechanism for a tempo-like template insert for the given
- ;; tag.
- (insert (semantic-format-tag-prototype tag)))
-=20
- (define-overload semantic-insert-foreign-tag (tag tagfile)
- "Insert TAG from a foreign buffer into the current buffer.
- TAG will have originated from TAGFILE.
- This function is overridable with the symbol `insert-foreign-tag'."
- (if (or (not tag) (not (semantic-tag-p tag)))
- (signal 'wrong-type-argument (list tag 'semantic-tag-p)))
- (:override)
- (message (semantic-format-tag-summarize tag)))
-=20
(make-obsolete-overload 'semantic-insert-foreign-token
'semantic-insert-foreign-tag)
=20
--- 2461,2466 ----
***************
*** 2491,2500 ****
"Take the current tag, and place it in the tag ring."
(interactive)
(senator-parse)
! (let ((ct (senator-current-tag)))
! (ring-insert senator-tag-ring (cons ct (buffer-file-name)))
! (message (semantic-format-tag-summarize ct))
! ct))
(semantic-alias-obsolete 'senator-copy-token 'senator-copy-tag)
=20
(defun senator-kill-tag ()
--- 2471,2481 ----
"Take the current tag, and place it in the tag ring."
(interactive)
(senator-parse)
! (let ((ft (semantic-obtain-foreign-tag)))
! (when ft
! (ring-insert senator-tag-ring ft)
! (message (semantic-format-tag-summarize ft)))
! ft))
(semantic-alias-obsolete 'senator-copy-token 'senator-copy-tag)
=20
(defun senator-kill-tag ()
***************
*** 2513,2520 ****
yanked to."
(interactive)
(or (ring-empty-p senator-tag-ring)
! (let ((tag (ring-ref senator-tag-ring 0)))
! (semantic-insert-foreign-tag (car tag) (cdr tag)))))
(semantic-alias-obsolete 'senator-yank-token 'senator-yank-tag)
=20
(defun senator-copy-tag-to-register (register &optional kill-flag)
--- 2494,2502 ----
yanked to."
(interactive)
(or (ring-empty-p senator-tag-ring)
! (let ((ft (ring-ref senator-tag-ring 0)))
! (semantic-foreign-tag-check ft)
! (semantic-insert-foreign-tag ft))))
(semantic-alias-obsolete 'senator-yank-token 'senator-yank-tag)
=20
(defun senator-copy-tag-to-register (register &optional kill-flag)
***************
*** 2522,2532 ****
Optional argument KILL-FLAG will delete the text of the tag to the
kill ring."
(interactive "cTag to register: \nP")
! (let ((ct (senator-current-tag)))
! (set-register register (cons ct (buffer-file-name)))
! (if kill-flag
! (kill-region (semantic-tag-start ct)
! (semantic-tag-end ct)))))
(semantic-alias-obsolete 'senator-copy-token-to-register
'senator-copy-tag-to-register)
=20
--- 2504,2516 ----
Optional argument KILL-FLAG will delete the text of the tag to the
kill ring."
(interactive "cTag to register: \nP")
! (senator-parse)
! (let ((ft (semantic-obtain-foreign-tag)))
! (when ft
! (set-register register ft)
! (if kill-flag
! (kill-region (semantic-tag-start ft)
! (semantic-tag-end ft))))))
(semantic-alias-obsolete 'senator-copy-token-to-register
'senator-copy-tag-to-register)
=20
***************
*** 2535,2542 ****
If senator is not active, use the original mechanism."
(let ((val (get-register (ad-get-arg 0))))
(if (and senator-minor-mode (interactive-p)
! (listp val) (semantic-tag-p (car val)))
! (semantic-insert-foreign-tag (car val) (cdr val))
ad-do-it)))
=20
(defadvice jump-to-register (around senator activate)
--- 2519,2526 ----
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)))
=20
(defadvice jump-to-register (around senator activate)
***************
*** 2544,2553 ****
If senator is not active, use the original mechanism."
(let ((val (get-register (ad-get-arg 0))))
(if (and senator-minor-mode (interactive-p)
! (listp val) (semantic-tag-p (car val)))
(progn
! (find-file (cdr val))
! (goto-char (semantic-tag-start (car val))))
ad-do-it)))
=20
(defun senator-transpose-tags-up ()
--- 2528,2537 ----
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)))
=20
(defun senator-transpose-tags-up ()
|