Function: semantic-edits-change-leaf-tag
semantic-edits-change-leaf-tag is a byte-compiled function defined in
edit.el.gz.
Signature
(semantic-edits-change-leaf-tag CHANGE)
Documentation
A leaf tag which completely encompasses CHANGE.
If change overlaps a tag, but is not encompassed in it, return nil.
Use semantic-edits-change-overlap-leaf-tag.
If CHANGE is completely encompassed in a tag, but overlaps sub-tags,
return nil.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/edit.el.gz
(defun semantic-edits-change-leaf-tag (change)
"A leaf tag which completely encompasses CHANGE.
If change overlaps a tag, but is not encompassed in it, return nil.
Use `semantic-edits-change-overlap-leaf-tag'.
If CHANGE is completely encompassed in a tag, but overlaps sub-tags,
return nil."
(let* ((start (semantic-edits-os change))
(end (semantic-edits-oe change))
(tags (nreverse
(semantic-find-tag-by-overlay-in-region
start end))))
;; A leaf is always first in this list
(if (and tags
(<= (semantic-tag-start (car tags)) start)
(> (semantic-tag-end (car tags)) end))
;; Ok, we have a match. If this tag has children,
;; we have to do more tests.
(let ((chil (semantic-tag-components (car tags))))
(if (not chil)
;; Simple leaf.
(car tags)
;; For this type, we say that we encompass it if the
;; change occurs outside the range of the children.
(if (or (not (semantic-tag-with-position-p (car chil)))
(> start (semantic-tag-end (nth (1- (length chil)) chil)))
(< end (semantic-tag-start (car chil))))
;; We have modifications to the definition of this parent
;; so we have to reparse the whole thing.
(car tags)
;; We actually modified an area between some children.
;; This means we should return nil, as that case is
;; calculated by someone else.
nil)))
nil)))