]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/senator.el
Update copyright year to 2015
[gnu-emacs] / lisp / cedet / semantic / senator.el
index 64f99a8ad6f881f9478012ec069a43a934ff6a6d..c58def60585e9080ba447b5ad29bd5605af94a46 100644 (file)
@@ -1,9 +1,9 @@
 ;;; semantic/senator.el --- SEmantic NAvigaTOR
 
-;; Copyright (C) 2000-201 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2015 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <david@dponce.com>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Created: 10 Nov 2000
 ;; Keywords: syntax
 
@@ -255,6 +255,7 @@ TEXT, BOUND, NOERROR, and COUNT arguments are interpreted."
   "Navigate to the next Semantic tag.
 Return the tag or nil if at end of buffer."
   (interactive)
+  (semantic-error-if-unparsed)
   (let ((pos (point))
         (tag (semantic-current-tag))
         where)
@@ -294,6 +295,7 @@ Return the tag or nil if at end of buffer."
   "Navigate to the previous Semantic tag.
 Return the tag or nil if at beginning of buffer."
   (interactive)
+  (semantic-error-if-unparsed)
   (let ((pos (point))
         (tag (semantic-current-tag))
         where)
@@ -519,6 +521,7 @@ If that parent which is only a reference in the function tag
 is found, we can jump to it.
 Some tags such as includes have other reference features."
   (interactive)
+  (semantic-error-if-unparsed)
   (let ((result (semantic-up-reference (or tag (semantic-current-tag)))))
     (if (not result)
         (error "No up reference found")
@@ -719,12 +722,24 @@ yanked to."
 (defun senator-copy-tag-to-register (register &optional kill-flag)
   "Copy the current tag into REGISTER.
 Optional argument KILL-FLAG will delete the text of the tag to the
-kill ring."
-  (interactive "cTag to register: \nP")
+kill ring.
+
+Interactively, reads the register using `register-read-with-preview',
+if available."
+  (interactive (list (if (fboundp 'register-read-with-preview)
+                        (register-read-with-preview "Tag to register: ")
+                      (read-char "Tag to register: "))
+                    current-prefix-arg))
   (semantic-fetch-tags)
   (let ((ft (semantic-obtain-foreign-tag)))
     (when ft
-      (set-register register ft)
+      (set-register
+       register (registerv-make
+                 ft
+                 :insert-func #'semantic-insert-foreign-tag
+                 :jump-func (lambda (v)
+                              (switch-to-buffer (semantic-tag-buffer v))
+                              (goto-char (semantic-tag-start v)))))
       (if kill-flag
           (kill-region (semantic-tag-start ft)
                        (semantic-tag-end ft))))))