]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/find.el
Merge from trunk after a lot of time.
[gnu-emacs] / lisp / cedet / semantic / find.el
index c62ed818945a718f61806e996c196c5b4ae98edf..f660c69ec3d0c5f5979d89ebb7bac327c21110e7 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/find.el --- Search routines for Semantic
 
-;; Copyright (C) 1999-2005, 2008-201 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2008-2013 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
@@ -49,6 +49,7 @@
 (require 'semantic/tag)
 
 (declare-function semantic-tag-protected-p "semantic/tag-ls")
+(declare-function semantic-tag-package-protected-p "semantic/tag-ls")
 
 ;;; Overlay Search Routines
 ;;
@@ -312,6 +313,15 @@ TABLE is a tag table.  See `semantic-something-to-tag-table'."
     (eq ,class (semantic-tag-class (car tags)))
     ,table))
 
+(defmacro semantic-filter-tags-by-class (class &optional table)
+  "Find all tags of class not in the list CLASS in TABLE.
+CLASS is a list of symbols representing the class of the token,
+such as 'variable, of 'function..
+TABLE is a tag table.  See `semantic-something-to-tag-table'."
+  `(semantic--find-tags-by-macro
+    (not (memq (semantic-tag-class (car tags)) ,class))
+    ,table))
+
 (defmacro semantic-find-tags-by-type (type &optional table)
   "Find all tags of with a type TYPE in TABLE.
 TYPE is a string or tag representing a data type as defined in the
@@ -333,7 +343,7 @@ Used in completion."
 
 ;;;###autoload
 (define-overloadable-function semantic-find-tags-by-scope-protection (scopeprotection parent &optional table)
-  "Find all tags accessable by SCOPEPROTECTION.
+  "Find all tags accessible by SCOPEPROTECTION.
 SCOPEPROTECTION is a symbol which can be returned by the method
 `semantic-tag-protection'.  A hard-coded order is used to determine a match.
 PARENT is a tag representing the PARENT slot needed for
@@ -362,12 +372,19 @@ See `semantic-tag-protected-p' for details on which tags are returned."
        table
       (require 'semantic/tag-ls)
       (semantic--find-tags-by-macro
-       (not (semantic-tag-protected-p (car tags) scopeprotection parent))
+       (not (and (semantic-tag-protected-p (car tags) scopeprotection parent)
+                (semantic-tag-package-protected-p (car tags) parent)))
        table)))
 
-(defsubst semantic-find-tags-included (&optional table)
+;;;###autoload
+(define-overloadable-function semantic-find-tags-included (&optional table)
   "Find all tags in TABLE that are of the 'include class.
-TABLE is a tag table.  See `semantic-something-to-tag-table'."
+TABLE is a tag table.  See `semantic-something-to-tag-table'.")
+
+(defun semantic-find-tags-included-default (&optional table)
+  "Find all tags in TABLE that are of the 'include class.
+TABLE is a tag table.  See `semantic-something-to-tag-table'.
+By default, just call `semantic-find-tags-by-class'."
   (semantic-find-tags-by-class 'include table))
 
 ;;; Deep Searches
@@ -427,7 +444,7 @@ TABLE is a tag table.  See `semantic-something-to-tag-table'."
 
 ;;; Old Style Brute Force Search Routines
 ;;
-;; These functions will search through tags lists explicity for
+;; These functions will search through tags lists explicitly for
 ;; desired information.
 
 ;; The -by-name nonterminal search can use the built in fcn
@@ -574,7 +591,7 @@ FUNCTION must return non-nil if an element of STREAM will be included
 in the new list.
 
 If optional argument SEARCH-PARTS is non-nil, all sub-parts of tags
-are searched.  The overloadable function `semantic-tag-componenets' is
+are searched.  The overloadable function `semantic-tag-components' is
 used for the searching child lists.  If SEARCH-PARTS is the symbol
 'positiononly, then only children that have positional information are
 searched.