Function: semantic-create-imenu-directory-index

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

Signature

(semantic-create-imenu-directory-index &optional STREAM)

Documentation

Create an imenu tag index based on all files active in semanticdb.

Optional argument STREAM is the stream of tags for the current buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/imenu.el.gz
(defun semantic-create-imenu-directory-index (&optional stream)
  "Create an imenu tag index based on all files active in semanticdb.
Optional argument STREAM is the stream of tags for the current buffer."
  (if (not semanticdb-current-database)
      (semantic-create-imenu-index-1 stream nil)
    ;; We have a database, list all files, with the current file on top.
    (let ((index (list
		  (cons (oref semanticdb-current-table file)
			(or (semantic-create-imenu-index-1 stream nil)
			    ;; No tags in this file
			    'file-only))))
	  (tables (semanticdb-get-database-tables semanticdb-current-database)))
	(while tables
	  (let ((semantic-imenu-directory-current-file
		 (oref (car tables) file))
		tags)
	    (when (and (not (eq (car tables) semanticdb-current-table))
		       (semanticdb-live-p (car tables))
		       (semanticdb-equivalent-mode (car tables))
		       )
	      (setq tags (oref (car tables) tags)
		    index (cons (cons semantic-imenu-directory-current-file
				      (or (and tags
					       ;; don't pass nil stream because
					       ;; it will use the current
					       ;; buffer
					       (semantic-create-imenu-index-1
						(oref (car tables) tags)
						nil))
					  ;; no tags in the file
					  'file-only))
				index)))
	    (setq tables (cdr tables))))

      ;; If enabled automatically rebuild other imenu directory
      ;; indexes based on the same Semantic database
      (or (not semantic-imenu-auto-rebuild-directory-indexes)
          ;; If auto rebuild already in progress does nothing
          semantic-imenu-auto-rebuild-running
          (unwind-protect
              (progn
                (setq semantic-imenu-auto-rebuild-running t)
                (semantic-imenu-rebuild-directory-indexes
                 semanticdb-current-database))
            (setq semantic-imenu-auto-rebuild-running nil)))

      (nreverse index))))