]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/senator.el
Update copyright year to 2015
[gnu-emacs] / lisp / cedet / semantic / senator.el
index 5399d4d56496a8d2e07114f0c07f54d8023c2770..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
 
@@ -179,8 +179,8 @@ source."
     (goto-char (semantic-tag-start tag))
     (when (re-search-forward (concat
                               ;; The tag name is expected to be
-                              ;; between word delimiters, whitespaces,
-                              ;; or punctuations.
+                              ;; between word delimiters, whitespace,
+                              ;; or punctuation.
                               "\\(\\<\\|\\s-+\\|\\s.\\)"
                               (regexp-quote name)
                               "\\(\\>\\|\\s-+\\|\\s.\\)")
@@ -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))))))