;;; semantic/senator.el --- SEmantic NAvigaTOR
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-;; 2009 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
;; (eval-when-compile (require 'hippie-exp))
-(declare-function semanticdb-fast-strip-find-results "semantic/db-find")
-(declare-function semanticdb-deep-find-tags-for-completion "semantic/db-find")
(declare-function semantic-analyze-tag-references "semantic/analyze/refs")
(declare-function semantic-analyze-refs-impl "semantic/analyze/refs")
(declare-function semantic-analyze-find-tag "semantic/analyze")
(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.\\)")
"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)
"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)
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")
(when ft
(ring-insert senator-tag-ring ft)
(kill-ring-save (semantic-tag-start ft) (semantic-tag-end ft))
- (when (interactive-p)
- (message "Use C-y to yank text. Use `senator-yank-tag' for prototype insert."))
- )
+ (when (called-interactively-p 'interactive)
+ (message "Use C-y to yank text. \
+Use `senator-yank-tag' for prototype insert.")))
ft))
;;;###autoload
(let ((ct (senator-copy-tag))) ;; this handles the reparse for us.
(kill-region (semantic-tag-start ct)
(semantic-tag-end ct))
- (when (interactive-p)
- (message "Use C-y to yank text. Use `senator-yank-tag' for prototype insert."))
- ))
+ (when (called-interactively-p 'interactive)
+ (message "Use C-y to yank text. \
+Use `senator-yank-tag' for prototype insert."))))
;;;###autoload
(defun senator-yank-tag ()
(let ((ft (ring-ref senator-tag-ring 0)))
(semantic-foreign-tag-check ft)
(semantic-insert-foreign-tag ft)
- (when (interactive-p)
+ (when (called-interactively-p 'interactive)
(message "Use C-y to recover the yank the text of %s."
- (semantic-tag-name ft)))
- )))
+ (semantic-tag-name ft))))))
;;;###autoload
(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))))))
;; [(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:
;; generated-autoload-file: "loaddefs.el"
-;; generated-autoload-feature: semantic/loaddefs
;; generated-autoload-load-name: "semantic/senator"
;; End:
-;; arch-tag: 397100d0-e2db-467e-8c19-d8d4d99d51f1
;;; semantic/senator.el ends here