Function: semantic-create-imenu-subindex

semantic-create-imenu-subindex is a byte-compiled function defined in imenu.el.gz.

Signature

(semantic-create-imenu-subindex TAGS)

Documentation

From TAGS, create an imenu index of interesting things.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/imenu.el.gz
(defun semantic-create-imenu-subindex (tags)
  "From TAGS, create an imenu index of interesting things."
  (let ((notypecheck (not semantic-imenu-expand-type-members))
	children index tag parts)
    (while tags
      (setq tag (car tags)
	    children (semantic-tag-components-with-overlays tag))
      (if (and (not notypecheck)
               (memq (semantic-tag-class tag)
                     semantic-imenu-expandable-tag-classes)
	       children
               )
          ;; to keep an homogeneous menu organization, type menu items
          ;; always have a sub-menu with at least the *definition*
          ;; item (even if the tag has no type components)
	  (progn
	    (setq parts children)
	    ;; There is options which create the submenu
	    ;;  * Type has an overlay, but children do.
	    ;; The type doesn't have to have it's own overlay,
	    ;; but a type with no overlay and no children should be
	    ;; invalid.
	    (setq index
		  (cons
		   (cons
		    (funcall semantic-imenu-summary-function tag)
		    ;; Add a menu for getting at the type definitions
		    (if (and parts
			     ;; Note to self: enable menu items for
			     ;; sub parts even if they are not proper
			     ;; tags.
			     (semantic-tag-p (car parts)))
			(let ((submenu
			       (if (and semantic-imenu-bucketize-type-members
					semantic-imenu-bucketize-file)
				   (semantic-create-imenu-index-1 parts tag)
				 (semantic-create-imenu-subindex parts))))
			  ;; Only add a *definition* if we have a position
			  ;; in that type tag.
			  (if (semantic-tag-with-position-p tag)
			      (cons
			       (cons "*definition*"
				     (semantic-imenu-tag-overlay tag))
			       submenu)
			    submenu))
		      ;; There were no parts, or something like that, so
		      ;; instead just put the definition here.
		      (if (semantic-tag-with-position-p tag)
			  (semantic-imenu-tag-overlay tag)
			nil)
		      ))
		   index)))
	(if (semantic-tag-with-position-p tag)
	    (setq index (cons
			 (cons
			  (funcall semantic-imenu-summary-function tag)
			  (semantic-imenu-tag-overlay tag))
			 index))))
      (setq tags (cdr tags)))
    ;; `imenu--split-submenus' sort submenus according to
    ;; `imenu-sort-function' setting and split them up if they are
    ;; longer than `imenu-max-items'.
    (imenu--split-submenus (nreverse index))))