Function: semanticdb-create-ebrowse-database

semanticdb-create-ebrowse-database is an interactive and byte-compiled function defined in db-ebrowse.el.gz.

Signature

(semanticdb-create-ebrowse-database DIR)

Documentation

Create an EBROWSE database for directory DIR.

The database file is stored in ~/.semanticdb, or whichever directory is specified by semanticdb-default-save-directory.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/db-ebrowse.el.gz
(defun semanticdb-create-ebrowse-database (dir)
  "Create an EBROWSE database for directory DIR.
The database file is stored in ~/.semanticdb, or whichever directory
is specified by `semanticdb-default-save-directory'."
  (interactive "DDirectory: ")
  (setq dir (file-name-as-directory dir)) ;; for / on end
  (let* ((savein (semanticdb-ebrowse-file-for-directory dir))
	 (filebuff (get-buffer-create "*SEMANTICDB EBROWSE TMP*"))
	 (files (directory-files (expand-file-name dir) t))
	 ;; (mma auto-mode-alist)
	 ;; (regexp nil)
	 )
    ;; Create the input to the ebrowse command
    (with-current-buffer filebuff
      (buffer-disable-undo filebuff)
      (setq default-directory (expand-file-name dir))

      ;;; @TODO - convert to use semanticdb-collect-matching-filenames
      ;; to get the file names.


      (mapc (lambda (f)
	      (when (semanticdb-ebrowse-C-file-p f)
		(insert f)
		(insert "\n")))
	    files)
      ;; Cleanup the ebrowse output buffer.
      (with-current-buffer (get-buffer-create "*EBROWSE OUTPUT*")
	(erase-buffer))
      ;; Call the EBROWSE command.
      (message "Creating ebrowse file: %s ..." savein)
      (call-process-region (point-min) (point-max)
			   ebrowse-program-name
                           nil "*EBROWSE OUTPUT*" nil
			   (concat "--output-file=" savein)
			   "--very-verbose")
      )
    ;; Create a short LOADER program for loading in this database.
    (let* ((lfn (concat savein "-load.el"))
	   (lf (find-file-noselect lfn)))
      (with-current-buffer lf
	(erase-buffer)
	(insert "(semanticdb-ebrowse-load-helper \""
		(expand-file-name dir)
		"\")\n")
	(save-buffer)
	(kill-buffer (current-buffer)))
      (message "Creating ebrowse file: %s ... done" savein)
      ;; Reload that database
      (load lfn nil t)
      )))