From: Eric Ludlam Date: Sun, 22 Mar 2015 21:35:27 +0000 (-0400) Subject: semantic: New function to calculate scope around tag X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fdd5968c0b451cd38a923541de8aa5ce2422bfa8;p=emacs.git semantic: New function to calculate scope around tag * lisp/cedet/semantic/scope.el (semantic-calculate-scope-for-tag): New. --- diff --git a/lisp/cedet/semantic/scope.el b/lisp/cedet/semantic/scope.el index 9bade569659..272f37d9858 100644 --- a/lisp/cedet/semantic/scope.el +++ b/lisp/cedet/semantic/scope.el @@ -767,6 +767,16 @@ The class returned from the scope calculation is variable ;; can reset the scope cache without affecting others. (clone scopecache))))) +(defun semantic-calculate-scope-for-tag (tag) + "Calculate the current scope that is around TAG. +Return nil if TAG has no position, or we cannot otherwise find a scope. +Use this when pulling a datatype off TAG so when it is looked up +it has the right context around it." + (save-current-buffer + (when (semantic-tag-with-position-p tag) + (semantic-go-to-tag tag) + (semantic-calculate-scope (point)))) ) + (defun semantic-scope-find (name &optional class scope-in) "Find the tag with NAME, and optional CLASS in the current SCOPE-IN. Searches various elements of the scope for NAME. Return ALL the