cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-ebrowse.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-el.el: Require semantic/lex-spp.
Require semantic/db instead of semantic/db-search.
cedet/semantic/db-file.el: Declare inversion-test and
data-debug-insert-thing.
(semanticdb-load-database): Load inversion only if necessary.
cedet/semantic/db-find.el: Autoload semanticdb-find-default-throttle.
Defvar data-debug-thing-alist, and ede-current-project.
Declare data-debug-insert-stuff-list, data-debug-insert-tag-list,
semantic-scope-reset-cache, and semanticdb-typecache-notify-reset.
Require semantic/tag-file, and semantic/sort.
(semantic-reset): Require semantic/scope.
(semanticdb-partial-synchronize): Require semantic/db-typecache.
(semanticdb-find-table-for-include) Move up to avoid compiler warning.
cedet/semantic/db-global.el: Declare data-debug-new-buffer and
data-debug-insert-thing.
(semanticdb-project-database-global) Move up to avoid compiler warning.
cedet/semantic/db-javascript.el: Fix provide statement.
Require semantic/db-find instead of semantic/db-search.
cedet/semantic/db-mode.el: Declare semantic-lex-spp-set-dynamic-table.
(semanticdb-current-database, semanticdb-current-table): Move into
semantic/db.el
cedet/semantic/db-ref.el: Require eieio, semantic/db, and semantic/util.
Declare data-debug-new-buffer and data-debug-insert-object-slots.
Defvar semantic-case-fold. Require semantic/find when compiling.
cedet/semantic/db-typecache.el: Require semantic/tag-ls,
semantic/analyze/fcn, and semantic/scope. Declare
data-debug-insert-thing and data-debug-new-buffer.
cedet/semantic/db.el (semanticdb-search-results-table): Move class
definition here from semantic/db-search.el.
(semanticdb-current-database, semanticdb-current-table) Move variable
definitions here from semantic/db-mode.el.
2009-08-31 00:45:41 +00:00
|
|
|
;;; semantic/db-file.el --- Save a semanticdb to a cache file.
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
|
2016-01-01 01:16:19 -08:00
|
|
|
;;; Copyright (C) 2000-2005, 2007-2016 Free Software Foundation, Inc.
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
|
|
|
|
;; Author: Eric M. Ludlam <zappo@gnu.org>
|
|
|
|
;; Keywords: tags
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;;
|
|
|
|
;; A set of semanticdb classes for persistently saving caches on disk.
|
|
|
|
;;
|
|
|
|
|
|
|
|
(require 'semantic/db)
|
|
|
|
(require 'cedet-files)
|
2012-10-25 22:13:16 +02:00
|
|
|
(require 'data-debug)
|
2012-10-02 02:10:29 +08:00
|
|
|
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(defvar semanticdb-file-version semantic-version
|
|
|
|
"Version of semanticdb we are writing files to disk with.")
|
|
|
|
(defvar semanticdb-file-incompatible-version "1.4"
|
|
|
|
"Version of semanticdb we are not reverse compatible with.")
|
|
|
|
|
|
|
|
;;; Settings
|
|
|
|
;;
|
|
|
|
(defcustom semanticdb-default-file-name "semantic.cache"
|
2009-09-21 18:20:50 +00:00
|
|
|
"File name of the semantic tag cache."
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
:group 'semanticdb
|
|
|
|
:type 'string)
|
|
|
|
|
2009-09-21 18:20:50 +00:00
|
|
|
(defcustom semanticdb-default-save-directory
|
2009-10-04 01:03:51 +00:00
|
|
|
(locate-user-emacs-file "semanticdb" ".semanticdb")
|
2009-09-21 18:20:50 +00:00
|
|
|
"Directory name where semantic cache files are stored.
|
Merge with CEDET upstream (rev. 8499).
lisp/
* eieio/eieio-datadebug.el (data-debug/eieio-insert-slots):
Inhibit read only while inserting objects.
lisp/cedet/
* semantic.el (navigate-menu): Yank Tag :enable. Make sure
`senator-tag-ring' is bound.
(semantic-parse-region-default): Stop reversing the output of
parse-whole-stream.
(semantic-repeat-parse-whole-stream): Append returned tags
differently, so they come out in the right order.
* semantic/sb.el (semantic-sb-filter-tags-of-class): New option.
(semantic-sb-fetch-tag-table): Filter tags being bucketed to exclude
tags belonging to above filtered classes.
* semantic/find.el (semantic-filter-tags-by-class): New function.
* semantic/tag-ls.el (semantic-tag-similar-p-default): Add
short-circuit in case tag1 and 2 are identical.
* semantic/analyze/fcn.el
(semantic-analyze-dereference-metatype-stack): Use
`semantic-tag-similar-p' instead of 'eq' when comparing two tags
during metatype evaluation in case they are the same, but not the same
node. (Tweaked patch from Tomasz Gajewski) (Tiny change)
* semantic/db-find.el (semanticdb-partial-synchronize): Fix require to
semantic/db-typecache to be correct.
(semanticdb-find-tags-external-children-of-type): Make this a brutish
search by default.
* semantic/sort.el (semantic-tag-external-member-children-default):
When calling `semanticdb-find-tags-external-children-of-type', pass in
the input tag as the place to start searching for externally defined
methods.
* semantic/db-file.el (semanticdb-default-save-directory): Doc
fix: Add ref to default value.
* semantic/complete.el (semantic-complete-post-command-hook): When
detecting if cursor is outside completion area, do so if cursor moves
before start of overlay, or the original starting location of the
overlay (i.e., if user deletes past beginning of the overlay region).
(semantic-complete-inline-tag-engine): Initialize original start of
`semantic-complete-inline-overlay'.
* semantic/bovine/c.el (semantic-c-describe-environment): Update some
section titles. Test semanticdb table before printing it.
(semantic-c-reset-preprocessor-symbol-map): Update
`semantic-lex-spp-macro-symbol-obarray' outside the loop over all the
files contributing to its value.
(semantic-c-describe-environment): If there is an EDE project but no
spp symbols from it, say so.
* srecode/args.el (srecode-semantic-handle-:project): New argument
handler. Provide variable values if not in an EDE project.
* srecode/srt-mode.el (srecode-template-mode): Fix typo on srecode
name.
* srecode/cpp.el (srecode-semantic-handle-:c): Replace all characters
in FILENAME_SYMBOL that aren't valid CPP symbol chars.
* srecode/map.el (srecode-map-validate-file-for-mode): Force semantic
to load if it is not active in the template being added to the map.
* srecode/srt.el: Add local variables for setting the autoload file
name.
(srecode-semantic-handle-:srt): New autoload cookie
* ede.el (ede-apply-preprocessor-map): Apply map to
`semantic-lex-spp-project-macro-symbol-obarray' instead of the system
one. Add require for semantic.
* ede/proj-elisp.el (ede-update-version-in-source): In case a file has
both a version variable and a Version: comment, always use
`call-next-method'.
* ede/cpp-root.el (ede-set-project-variables): Deleted.
`ede-preprocessor-map' does the job this function was attempting to do
with :spp-table.
(ede-preprocessor-map): Update file tests to provide better messages.
Do not try to get symbols from a file that is the file in the current
buffer.
* ede/base.el (ede-project-placeholder): Add more documentation to
:file slot.
(ede-load-cache): Use `insert-file-contents' instead of
`find-file-noselect' in order to avoid activating other tools.
* semantic/bovine/c.el (semantic-get-local-variables): Also add a new
variable 'this' if we are in an inline member function. For detecting
this, we check overlays at point if there is a class spanning the
current function. Also, the variable 'this' has to be a pointer.
* semantic/bovine/gcc.el (semantic-gcc-setup): Fail gracefully when
querying g++ for defines returns an error.
* srecode/srt-mode.el:
* srecode/compile.el:
* semantic/elp.el:
* semantic/db-el.el:
* semantic/complete.el:
* ede.el:
* cogre.el:
* srecode/table.el:
* srecode/mode.el:
* srecode/insert.el:
* srecode/compile.el:
* semantic/decorate/include.el:
* semantic/db.el:
* semantic/adebug.el:
* ede/auto.el:
* srecode/dictionary.el:
* semantic/ede-grammar.el:
* semantic/db.el:
* semantic/db-find.el:
* semantic/db-file.el:
* semantic/complete.el:
* semantic/bovine/c.el:
* semantic/analyze.el:
* ede/util.el:
* ede/proj.el:
* ede/proj-elisp.el:
* ede/pconf.el:
* ede/locate.el:
* ede.el: Adapt to EIEIO namespace cleanup: Rename `object-name' to
`eieio-object-name', `object-set-name-string' to
`eieio-object-set-name-string', `object-class' to
`eieio-object-class', `class-parent' to `eieio-class-parent',
`class-parents' to `eieio-class-parents', `class-children' to
`eieio-class-children', `object-name-string' to
`eieio-object-name-string', `object-class-fast' to
`eieio--object-class'. Also replace direct access with new accessor
functions.
* ede/cpp-root.el (ede-project-autoload, initialize-instance): Fix EDE
file symbol to match rename. Fix ede-cpp-root symbol to include
-project in name.
* cedet-files.el (cedet-files-list-recursively): New function.
Recursively find files whose names are matching to given regex
* ede.el (ede-current-project): Rewrite to avoid imperative style.
* ede/files.el (ede-find-file): Simplify code.
* ede/base.el (ede-normalize-file/directory): Add function to
normalize :file or :directory slots if they are missing.
* ede/cpp-root.el (ede-cpp-root-project): Add compile-command slot.
(project-compile-project): Compiles project using value specified in
:compule-command slot or in compile-command local variable. Value of
slot or local variable could be string or function that receives
project and should return string that will be invoked as command.
(project-compile-target): Invokes compilation of whole project
* ede/files.el (ede-find-project-root): New function to find root of
project that contains specific file.
(ede-files-find-existing): New function which checks presence of given
directory in the list of registered projects.
etc/
* srecode/ede-autoconf.srt: Change Copyright to FSF.
(ede-empty): Change AC_INIT to use PROJECT_NAME, and PROJECT_VERSION.
* srecode/ede-make.srt (ede-empty): Add a dependency on :project. Add
header comment specifying the project's relative path.
* srecode/c.srt (header_guard): Upcase the filename symbol.
* srecode/java.srt (empty-main): New.
(class-tag): Decapitalize class.
2013-03-21 23:11:03 +01:00
|
|
|
By default, it is either ~/.emacs.d/semanticdb, or ~/.semanticdb depending
|
|
|
|
on which exists.
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
If this value is nil, files are saved in the current directory. If the value
|
|
|
|
is a valid directory, then it overrides `semanticdb-default-file-name' and
|
|
|
|
stores caches in a coded file name in this directory."
|
|
|
|
:group 'semanticdb
|
|
|
|
:type '(choice :tag "Default-Directory"
|
|
|
|
:menu-tag "Default-Directory"
|
|
|
|
(const :tag "Use current directory" :value nil)
|
|
|
|
(directory)))
|
|
|
|
|
|
|
|
(defcustom semanticdb-persistent-path '(always)
|
2009-09-21 18:20:50 +00:00
|
|
|
"List of valid paths that semanticdb will cache tags to.
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
When `global-semanticdb-minor-mode' is active, tag lists will
|
|
|
|
be saved to disk when Emacs exits. Not all directories will have
|
|
|
|
tags that should be saved.
|
|
|
|
The value should be a list of valid paths. A path can be a string,
|
|
|
|
indicating a directory in which to save a variable. An element in the
|
|
|
|
list can also be a symbol. Valid symbols are `never', which will
|
|
|
|
disable any saving anywhere, `always', which enables saving
|
|
|
|
everywhere, or `project', which enables saving in any directory that
|
|
|
|
passes a list of predicates in `semanticdb-project-predicate-functions'."
|
|
|
|
:group 'semanticdb
|
2016-01-28 17:13:38 -05:00
|
|
|
:type '(repeat (choice (string :tag "Directory") (const never) (const always)
|
|
|
|
(const project))))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
|
2012-10-23 11:06:07 -04:00
|
|
|
(define-obsolete-variable-alias 'semanticdb-save-database-hooks
|
|
|
|
'semanticdb-save-database-functions "24.3")
|
|
|
|
(defcustom semanticdb-save-database-functions nil
|
2009-09-26 18:09:29 +00:00
|
|
|
"Abnormal hook run after a database is saved.
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
Each function is called with one argument, the object representing
|
|
|
|
the database recently written."
|
|
|
|
:group 'semanticdb
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
(defvar semanticdb-dir-sep-char (if (boundp 'directory-sep-char)
|
|
|
|
(symbol-value 'directory-sep-char)
|
|
|
|
?/)
|
|
|
|
"Character used for directory separation.
|
|
|
|
Obsoleted in some versions of Emacs. Needed in others.
|
|
|
|
NOTE: This should get deleted from semantic soon.")
|
|
|
|
|
|
|
|
(defun semanticdb-fix-pathname (dir)
|
|
|
|
"If DIR is broken, fix it.
|
|
|
|
Force DIR to end with a /.
|
|
|
|
Note: Same as `file-name-as-directory'.
|
|
|
|
NOTE: This should get deleted from semantic soon."
|
|
|
|
(file-name-as-directory dir))
|
|
|
|
;; I didn't initially know about the above fcn. Keep the below as a
|
|
|
|
;; reference. Delete it someday once I've proven everything is the same.
|
|
|
|
;; (if (not (= semanticdb-dir-sep-char (aref path (1- (length path)))))
|
|
|
|
;; (concat path (list semanticdb-dir-sep-char))
|
|
|
|
;; path))
|
|
|
|
|
|
|
|
;;; Classes
|
|
|
|
;;
|
2009-09-07 17:59:16 +00:00
|
|
|
;;;###autoload
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(defclass semanticdb-project-database-file (semanticdb-project-database
|
|
|
|
eieio-persistent)
|
|
|
|
((file-header-line :initform ";; SEMANTICDB Tags save file")
|
|
|
|
(do-backups :initform nil)
|
|
|
|
(semantic-tag-version :initarg :semantic-tag-version
|
|
|
|
:initform "1.4"
|
|
|
|
:documentation
|
|
|
|
"The version of the tags saved.
|
|
|
|
The default value is 1.4. In semantic 1.4 there was no versioning, so
|
|
|
|
when those files are loaded, this becomes the version number.
|
|
|
|
To save the version number, we must hand-set this version string.")
|
|
|
|
(semanticdb-version :initarg :semanticdb-version
|
|
|
|
:initform "1.4"
|
|
|
|
:documentation
|
|
|
|
"The version of the object system saved.
|
|
|
|
The default value is 1.4. In semantic 1.4, there was no versioning,
|
|
|
|
so when those files are loaded, this becomes the version number.
|
|
|
|
To save the version number, we must hand-set this version string.")
|
|
|
|
)
|
|
|
|
"Database of file tables saved to disk.")
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
;;
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-create-database ((dbc (subclass semanticdb-project-database-file))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
directory)
|
|
|
|
"Create a new semantic database for DIRECTORY and return it.
|
|
|
|
If a database for DIRECTORY has already been loaded, return it.
|
|
|
|
If a database for DIRECTORY exists, then load that database, and return it.
|
|
|
|
If DIRECTORY doesn't exist, create a new one."
|
|
|
|
;; Make sure this is fully expanded so we don't get duplicates.
|
|
|
|
(setq directory (file-truename directory))
|
|
|
|
(let* ((fn (semanticdb-cache-filename dbc directory))
|
|
|
|
(db (or (semanticdb-file-loaded-p fn)
|
|
|
|
(if (file-exists-p fn)
|
|
|
|
(progn
|
|
|
|
(semanticdb-load-database fn))))))
|
|
|
|
(unless db
|
|
|
|
(setq db (make-instance
|
|
|
|
dbc ; Create the database requested. Perhaps
|
|
|
|
(concat (file-name-nondirectory
|
|
|
|
(directory-file-name
|
|
|
|
directory))
|
|
|
|
"/")
|
|
|
|
:file fn :tables nil
|
2012-10-02 02:10:29 +08:00
|
|
|
:semantic-tag-version semantic-tag-version
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
:semanticdb-version semanticdb-file-version)))
|
|
|
|
;; Set this up here. We can't put it in the constructor because it
|
|
|
|
;; would be saved, and we want DB files to be portable.
|
|
|
|
(oset db reference-directory directory)
|
|
|
|
db))
|
|
|
|
|
|
|
|
;;; File IO
|
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-ebrowse.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-el.el: Require semantic/lex-spp.
Require semantic/db instead of semantic/db-search.
cedet/semantic/db-file.el: Declare inversion-test and
data-debug-insert-thing.
(semanticdb-load-database): Load inversion only if necessary.
cedet/semantic/db-find.el: Autoload semanticdb-find-default-throttle.
Defvar data-debug-thing-alist, and ede-current-project.
Declare data-debug-insert-stuff-list, data-debug-insert-tag-list,
semantic-scope-reset-cache, and semanticdb-typecache-notify-reset.
Require semantic/tag-file, and semantic/sort.
(semantic-reset): Require semantic/scope.
(semanticdb-partial-synchronize): Require semantic/db-typecache.
(semanticdb-find-table-for-include) Move up to avoid compiler warning.
cedet/semantic/db-global.el: Declare data-debug-new-buffer and
data-debug-insert-thing.
(semanticdb-project-database-global) Move up to avoid compiler warning.
cedet/semantic/db-javascript.el: Fix provide statement.
Require semantic/db-find instead of semantic/db-search.
cedet/semantic/db-mode.el: Declare semantic-lex-spp-set-dynamic-table.
(semanticdb-current-database, semanticdb-current-table): Move into
semantic/db.el
cedet/semantic/db-ref.el: Require eieio, semantic/db, and semantic/util.
Declare data-debug-new-buffer and data-debug-insert-object-slots.
Defvar semantic-case-fold. Require semantic/find when compiling.
cedet/semantic/db-typecache.el: Require semantic/tag-ls,
semantic/analyze/fcn, and semantic/scope. Declare
data-debug-insert-thing and data-debug-new-buffer.
cedet/semantic/db.el (semanticdb-search-results-table): Move class
definition here from semantic/db-search.el.
(semanticdb-current-database, semanticdb-current-table) Move variable
definitions here from semantic/db-mode.el.
2009-08-31 00:45:41 +00:00
|
|
|
|
|
|
|
(declare-function inversion-test "inversion")
|
|
|
|
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(defun semanticdb-load-database (filename)
|
|
|
|
"Load the database FILENAME."
|
|
|
|
(condition-case foo
|
2015-01-07 23:11:58 -05:00
|
|
|
(let* ((r (eieio-persistent-read filename
|
|
|
|
'semanticdb-project-database-file))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(c (semanticdb-get-database-tables r))
|
|
|
|
(tv (oref r semantic-tag-version))
|
|
|
|
(fv (oref r semanticdb-version))
|
|
|
|
)
|
|
|
|
;; Restore the parent-db connection
|
|
|
|
(while c
|
|
|
|
(oset (car c) parent-db r)
|
|
|
|
(setq c (cdr c)))
|
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-ebrowse.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-el.el: Require semantic/lex-spp.
Require semantic/db instead of semantic/db-search.
cedet/semantic/db-file.el: Declare inversion-test and
data-debug-insert-thing.
(semanticdb-load-database): Load inversion only if necessary.
cedet/semantic/db-find.el: Autoload semanticdb-find-default-throttle.
Defvar data-debug-thing-alist, and ede-current-project.
Declare data-debug-insert-stuff-list, data-debug-insert-tag-list,
semantic-scope-reset-cache, and semanticdb-typecache-notify-reset.
Require semantic/tag-file, and semantic/sort.
(semantic-reset): Require semantic/scope.
(semanticdb-partial-synchronize): Require semantic/db-typecache.
(semanticdb-find-table-for-include) Move up to avoid compiler warning.
cedet/semantic/db-global.el: Declare data-debug-new-buffer and
data-debug-insert-thing.
(semanticdb-project-database-global) Move up to avoid compiler warning.
cedet/semantic/db-javascript.el: Fix provide statement.
Require semantic/db-find instead of semantic/db-search.
cedet/semantic/db-mode.el: Declare semantic-lex-spp-set-dynamic-table.
(semanticdb-current-database, semanticdb-current-table): Move into
semantic/db.el
cedet/semantic/db-ref.el: Require eieio, semantic/db, and semantic/util.
Declare data-debug-new-buffer and data-debug-insert-object-slots.
Defvar semantic-case-fold. Require semantic/find when compiling.
cedet/semantic/db-typecache.el: Require semantic/tag-ls,
semantic/analyze/fcn, and semantic/scope. Declare
data-debug-insert-thing and data-debug-new-buffer.
cedet/semantic/db.el (semanticdb-search-results-table): Move class
definition here from semantic/db-search.el.
(semanticdb-current-database, semanticdb-current-table) Move variable
definitions here from semantic/db-mode.el.
2009-08-31 00:45:41 +00:00
|
|
|
(unless (and (equal semanticdb-file-version fv)
|
|
|
|
(equal semantic-tag-version tv))
|
|
|
|
;; Try not to load inversion unless we need it:
|
|
|
|
(require 'inversion)
|
|
|
|
(if (not (inversion-test 'semanticdb-file fv))
|
|
|
|
(when (inversion-test 'semantic-tag tv)
|
|
|
|
;; Incompatible version. Flush tables.
|
|
|
|
(semanticdb-flush-database-tables r)
|
|
|
|
;; Reset the version to new version.
|
|
|
|
(oset r semantic-tag-version semantic-tag-version)
|
|
|
|
;; Warn user
|
|
|
|
(message "Semanticdb file is old. Starting over for %s"
|
|
|
|
filename))
|
|
|
|
;; Version is not ok. Flush whole system
|
|
|
|
(message "semanticdb file is old. Starting over for %s"
|
|
|
|
filename)
|
|
|
|
;; This database is so old, we need to replace it.
|
|
|
|
;; We also need to delete it from the instance tracker.
|
|
|
|
(delete-instance r)
|
|
|
|
(setq r nil)))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
r)
|
|
|
|
(error (message "Cache Error: [%s] %s, Restart"
|
|
|
|
filename foo)
|
|
|
|
nil)))
|
|
|
|
|
|
|
|
(defun semanticdb-file-loaded-p (filename)
|
|
|
|
"Return the project belonging to FILENAME if it was already loaded."
|
|
|
|
(eieio-instance-tracker-find filename 'file 'semanticdb-database-list))
|
|
|
|
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-file-directory-exists-p ((DB semanticdb-project-database-file)
|
2011-12-14 13:05:20 -08:00
|
|
|
&optional suppress-questions)
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"Does the directory the database DB needs to write to exist?
|
2011-12-14 13:05:20 -08:00
|
|
|
If SUPPRESS-QUESTIONS, then do not ask to create the directory."
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(let ((dest (file-name-directory (oref DB file)))
|
|
|
|
)
|
|
|
|
(cond ((null dest)
|
|
|
|
;; @TODO - If it was never set up... what should we do ?
|
|
|
|
nil)
|
|
|
|
((file-exists-p dest) t)
|
2011-12-14 13:05:20 -08:00
|
|
|
((or suppress-questions
|
2009-09-21 18:20:50 +00:00
|
|
|
(and (boundp 'semanticdb--inhibit-make-directory)
|
|
|
|
semanticdb--inhibit-make-directory))
|
|
|
|
nil)
|
|
|
|
((y-or-n-p (format "Create directory %s for SemanticDB? " dest))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(make-directory dest t)
|
|
|
|
t)
|
2009-09-26 17:47:11 +00:00
|
|
|
(t
|
|
|
|
(if (boundp 'semanticdb--inhibit-make-directory)
|
|
|
|
(setq semanticdb--inhibit-make-directory t))
|
|
|
|
nil))))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-save-db ((DB semanticdb-project-database-file)
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
&optional
|
2011-12-14 13:05:20 -08:00
|
|
|
suppress-questions)
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"Write out the database DB to its file.
|
|
|
|
If DB is not specified, then use the current database."
|
|
|
|
(let ((objname (oref DB file)))
|
|
|
|
(when (and (semanticdb-dirty-p DB)
|
|
|
|
(semanticdb-live-p DB)
|
2011-12-14 13:05:20 -08:00
|
|
|
(semanticdb-file-directory-exists-p DB suppress-questions)
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(semanticdb-write-directory-p DB)
|
|
|
|
)
|
|
|
|
;;(message "Saving tag summary for %s..." objname)
|
|
|
|
(condition-case foo
|
|
|
|
(eieio-persistent-save (or DB semanticdb-current-database))
|
|
|
|
(file-error ; System error saving? Ignore it.
|
|
|
|
(message "%S: %s" foo objname))
|
|
|
|
(error
|
|
|
|
(cond
|
|
|
|
((and (listp foo)
|
|
|
|
(stringp (nth 1 foo))
|
|
|
|
(string-match "write[- ]protected" (nth 1 foo)))
|
|
|
|
(message (nth 1 foo)))
|
|
|
|
((and (listp foo)
|
|
|
|
(stringp (nth 1 foo))
|
|
|
|
(string-match "no such directory" (nth 1 foo)))
|
|
|
|
(message (nth 1 foo)))
|
|
|
|
(t
|
|
|
|
;; @todo - It should ask if we are not called from a hook.
|
|
|
|
;; How?
|
2011-12-14 13:05:20 -08:00
|
|
|
(if (or suppress-questions
|
Synch Semantic to CEDET 1.0.
Move CEDET ChangeLog entries to new file lisp/cedet/ChangeLog.
* semantic.el (semantic-version): Update to 2.0.
(semantic-mode-map): Add "," and "m" bindings.
(navigate-menu): Update.
* semantic/symref.el (semantic-symref-calculate-rootdir):
New function.
(semantic-symref-detect-symref-tool): Use it.
* semantic/symref/grep.el (semantic-symref-grep-shell): New var.
(semantic-symref-perform-search): Use it. Calculate root dir with
semantic-symref-calculate-rootdir.
(semantic-symref-derive-find-filepatterns): Improve error message.
* semantic/symref/list.el
(semantic-symref-results-mode-map): New bindings.
(semantic-symref-auto-expand-results): New option.
(semantic-symref-results-dump): Obey auto-expand.
(semantic-symref-list-expand-all, semantic-symref-regexp)
(semantic-symref-list-contract-all)
(semantic-symref-list-map-open-hits)
(semantic-symref-list-update-open-hits)
(semantic-symref-list-create-macro-on-open-hit)
(semantic-symref-list-call-macro-on-open-hits): New functions.
(semantic-symref-list-menu-entries)
(semantic-symref-list-menu): New vars.
(semantic-symref-list-map-open-hits): Move cursor to beginning of
match before calling the mapped function.
* semantic/doc.el
(semantic-documentation-comment-preceeding-tag): Do nothing if the
mode doesn't provide comment-start-skip.
* semantic/scope.el
(semantic-analyze-scope-nested-tags-default): Strip duplicates.
(semantic-analyze-scoped-inherited-tag-map): Take the tag we are
looking for as part of the scoped tags list.
* semantic/html.el (semantic-default-html-setup): Add
senator-step-at-tag-classes.
* semantic/decorate/include.el
(semantic-decoration-on-unknown-includes): Change light bgcolor.
(semantic-decoration-on-includes-highlight-default): Check that
the include tag has a postion.
* semantic/complete.el (semantic-collector-local-members):
(semantic-complete-read-tag-local-members)
(semantic-complete-jump-local-members): New class and functions.
(semantic-complete-self-insert): Save excursion before completing.
* semantic/analyze/complete.el
(semantic-analyze-possible-completions-default): If no completions
are found, return the raw by-name-only completion list. Add FLAGS
arguments. Add support for 'no-tc (type constraint) and
'no-unique, or no stripping duplicates.
(semantic-analyze-possible-completions-default): Add FLAGS arg.
* semantic/util-modes.el
(semantic-stickyfunc-show-only-functions-p): New option.
(semantic-stickyfunc-fetch-stickyline): Don't show stickytext for
the very first line in a buffer.
* semantic/util.el (semantic-hack-search)
(semantic-recursive-find-nonterminal-by-name)
(semantic-current-tag-interactive): Deleted.
(semantic-describe-buffer): Fix expand-nonterminal. Add
lex-syntax-mods, type relation separator char, and command
separation char.
(semantic-sanity-check): Only message if called interactively.
* semantic/tag.el (semantic-tag-deep-copy-one-tag): Copy the
:filename property and the tag position.
* semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
Add recursion limit.
* semantic/imenu.el (semantic-imenu-bucketize-type-members):
Make this buffer local, not the obsoleted variable.
* semantic/idle.el: Add breadcrumbs support.
(semantic-idle-summary-current-symbol-info-default)
(semantic-idle-tag-highlight)
(semantic-idle-completion-list-default): Use
semanticdb-without-unloaded-file-searches for speed, and to
conform to the controls that specify if the idle timer is supposed
to be parsing unparsed includes.
(semantic-idle-symbol-highlight-face)
(semantic-idle-symbol-maybe-highlight): Rename from *-summary-*.
Callers changed.
(semantic-idle-work-parse-neighboring-files-flag): Default to nil.
(semantic-idle-work-update-headers-flag): New var.
(semantic-idle-work-for-one-buffer): Use it.
(semantic-idle-local-symbol-highlight): Rename from
semantic-idle-tag-highlight.
(semantic-idle-truncate-long-summaries): New option.
* semantic/ia.el (semantic-ia-cache)
(semantic-ia-get-completions): Deleted. Callers changed.
(semantic-ia-show-variants): New command.
(semantic-ia-show-doc): If doc is empty, don't make a temp buffer.
(semantic-ia-show-summary): If there isn't anything to show, say so.
* semantic/grammar.el (semantic-grammar-create-package):
Save the buffer even in batch mode.
* semantic/fw.el
(semanticdb-without-unloaded-file-searches): New macro.
* semantic/dep.el (semantic-dependency-find-file-on-path):
Fix case dereferencing ede-object when it is a list.
* semantic/db-typecache.el (semanticdb-expand-nested-tag)
(semanticdb-typecache-faux-namespace): New functions.
(semanticdb-typecache-file-tags)
(semanticdb-typecache-merge-streams): Use them.
(semanticdb-typecache-file-tags): When deriving tags from a file,
give the mode a chance to monkey with the tag copy.
(semanticdb-typecache-find-default): Wrap find in save-excursion.
(semanticdb-typecache-find-by-name-helper): Merge found names down.
* semantic/db-global.el
(semanticdb-enable-gnu-global-in-buffer): Don't show messages if
GNU Global is not available and we don't want to throw an error.
* semantic/db-find.el (semanticdb-find-result-nth-in-buffer):
When trying to normalize the tag to a buffer, don't error if
set-buffer method doesn't exist.
* semantic/db-file.el (semanticdb-save-db): Simplify msg.
* semantic/db.el (semanticdb-refresh-table): If forcing a
refresh on a file not in a buffer, use semantic-find-file-noselect
and delete the buffer after use.
(semanticdb-current-database-list): When calculating root via
hooks, force it through true-filename and skip the list of
possible roots.
* semantic/ctxt.el (semantic-ctxt-imported-packages): New.
* semantic/analyze/debug.el
(semantic-analyzer-debug-insert-tag): Reset standard output to
current buffer.
(semantic-analyzer-debug-global-symbol)
(semantic-analyzer-debug-missing-innertype): Change "prefix" to
"symbol" in messages.
* semantic/analyze/refs.el: (semantic-analyze-refs-impl)
(semantic-analyze-refs-proto): When calculating value, make sure
the found tag is 'similar' to the originating tag.
(semantic--analyze-refs-find-tags-with-parent): Attempt to
identify matches via imported symbols of parents.
(semantic--analyze-refs-full-lookup-with-parents): Do a deep
search during the brute search.
* semantic/analyze.el
(semantic-analyze-find-tag-sequence-default): Be robust to
calculated scopes being nil.
* semantic/bovine/c.el (semantic-c-describe-environment): Add
project macro symbol array.
(semantic-c-parse-lexical-token): Add recursion limit.
(semantic-ctxt-imported-packages, semanticdb-expand-nested-tag):
New overrides.
(semantic-expand-c-tag-namelist): Split a full type from a typedef
out to its own tag.
(semantic-expand-c-tag-namelist): Do not split out a typedef'd
inline type if it is an anonymous type.
(semantic-c-reconstitute-token): Use the optional initializers as
a clue that some function is probably a constructor. When
defining the type of these constructors, split the parent name,
and use only the class part, if applicable.
* semantic/bovine/c-by.el:
* semantic/wisent/python-wy.el: Regenerate.
2010-09-18 22:49:54 -04:00
|
|
|
(y-or-n-p (format "Skip Error: %s ?" (car (cdr foo)))))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(message "Save Error: %S: %s" (car (cdr foo))
|
|
|
|
objname)
|
|
|
|
(error "%S" (car (cdr foo))))))))
|
2012-10-23 11:06:07 -04:00
|
|
|
(run-hook-with-args 'semanticdb-save-database-functions
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(or DB semanticdb-current-database))
|
|
|
|
;;(message "Saving tag summary for %s...done" objname)
|
|
|
|
)
|
|
|
|
))
|
|
|
|
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-live-p ((obj semanticdb-project-database))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"Return non-nil if the file associated with OBJ is live.
|
|
|
|
Live databases are objects associated with existing directories."
|
|
|
|
(and (slot-boundp obj 'reference-directory)
|
|
|
|
(file-exists-p (oref obj reference-directory))))
|
|
|
|
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-live-p ((obj semanticdb-table))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"Return non-nil if the file associated with OBJ is live.
|
|
|
|
Live files are either buffers in Emacs, or files existing on the filesystem."
|
|
|
|
(let ((full-filename (semanticdb-full-filename obj)))
|
|
|
|
(or (find-buffer-visiting full-filename)
|
|
|
|
(file-exists-p full-filename))))
|
|
|
|
|
|
|
|
(defvar semanticdb-data-debug-on-write-error nil
|
|
|
|
"Run the data debugger on tables that issue errors.
|
|
|
|
This variable is set to nil after the first error is encountered
|
|
|
|
to prevent overload.")
|
|
|
|
|
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-ebrowse.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-el.el: Require semantic/lex-spp.
Require semantic/db instead of semantic/db-search.
cedet/semantic/db-file.el: Declare inversion-test and
data-debug-insert-thing.
(semanticdb-load-database): Load inversion only if necessary.
cedet/semantic/db-find.el: Autoload semanticdb-find-default-throttle.
Defvar data-debug-thing-alist, and ede-current-project.
Declare data-debug-insert-stuff-list, data-debug-insert-tag-list,
semantic-scope-reset-cache, and semanticdb-typecache-notify-reset.
Require semantic/tag-file, and semantic/sort.
(semantic-reset): Require semantic/scope.
(semanticdb-partial-synchronize): Require semantic/db-typecache.
(semanticdb-find-table-for-include) Move up to avoid compiler warning.
cedet/semantic/db-global.el: Declare data-debug-new-buffer and
data-debug-insert-thing.
(semanticdb-project-database-global) Move up to avoid compiler warning.
cedet/semantic/db-javascript.el: Fix provide statement.
Require semantic/db-find instead of semantic/db-search.
cedet/semantic/db-mode.el: Declare semantic-lex-spp-set-dynamic-table.
(semanticdb-current-database, semanticdb-current-table): Move into
semantic/db.el
cedet/semantic/db-ref.el: Require eieio, semantic/db, and semantic/util.
Declare data-debug-new-buffer and data-debug-insert-object-slots.
Defvar semantic-case-fold. Require semantic/find when compiling.
cedet/semantic/db-typecache.el: Require semantic/tag-ls,
semantic/analyze/fcn, and semantic/scope. Declare
data-debug-insert-thing and data-debug-new-buffer.
cedet/semantic/db.el (semanticdb-search-results-table): Move class
definition here from semantic/db-search.el.
(semanticdb-current-database, semanticdb-current-table) Move variable
definitions here from semantic/db-mode.el.
2009-08-31 00:45:41 +00:00
|
|
|
(declare-function data-debug-insert-thing "data-debug")
|
|
|
|
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod object-write ((obj semanticdb-table))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"When writing a table, we have to make sure we deoverlay it first.
|
2010-07-20 02:04:31 +02:00
|
|
|
Restore the overlays after writing.
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
Argument OBJ is the object to write."
|
|
|
|
(when (semanticdb-live-p obj)
|
|
|
|
(when (semanticdb-in-buffer-p obj)
|
* cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
* cedet/semantic/symref/list.el (semantic-symref-rb-toggle-expand-tag):
* cedet/semantic/symref/grep.el (semantic-symref-perform-search):
* cedet/semantic/bovine/gcc.el (semantic-gcc-query):
* cedet/semantic/bovine/c.el (semantic-c-parse-lexical-token):
* cedet/semantic/analyze/debug.el (semantic-analyzer-debug-add-buttons)
(semantic-analyzer-debug-global-symbol)
(semantic-analyzer-debug-missing-innertype)
(semantic-analyzer-debug-insert-include-summary):
* cedet/semantic/util.el (semantic-file-tag-table):
(semantic-describe-buffer-var-helper, semantic-something-to-tag-table)
(semantic-recursive-find-nonterminal-by-name):
* cedet/semantic/tag-ls.el (semantic-tag-calculate-parent-default):
* cedet/semantic/tag-file.el (semantic-prototype-file):
* cedet/semantic/symref.el (semantic-symref-parse-tool-output):
* cedet/semantic/sb.el (semantic-sb-fetch-tag-table):
* cedet/semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
* cedet/semantic/idle.el (semantic-idle-work-for-one-buffer):
(semantic-idle-summary-maybe-highlight):
* cedet/semantic/ia-sb.el (semantic-ia-speedbar)
(semantic-ia-sb-tag-info):
* cedet/semantic/grammar.el (semantic-analyze-possible-completions):
* cedet/semantic/find.el (semantic-brute-find-tag-by-position):
* cedet/semantic/ede-grammar.el (project-compile-target):
(ede-proj-makefile-insert-variables):
* cedet/semantic/debug.el (semantic-debug-set-parser-location):
(semantic-debug-set-source-location, semantic-debug-interface-layout)
(semantic-debug-mode, semantic-debug):
* cedet/semantic/db.el (semanticdb-needs-refresh-p):
* cedet/semantic/db-typecache.el (semanticdb-typecache-refresh-for-buffer):
* cedet/semantic/db-javascript.el (semanticdb-equivalent-mode):
* cedet/semantic/db-find.el (semanticdb-find-log-new-search)
(semanticdb-find-translate-path-includes--internal)
(semanticdb-reset-log, semanticdb-find-log-activity):
* cedet/semantic/db-file.el (object-write):
* cedet/semantic/db-el.el (semanticdb-equivalent-mode):
* cedet/semantic/db-ebrowse.el (semanticdb-ebrowse-C-file-p)
(semanticdb-create-ebrowse-database):
* cedet/semantic/db-debug.el (semanticdb-table-sanity-check):
* cedet/semantic/complete.el (semantic-displayor-focus-request)
(semantic-collector-calculate-completions-raw)
(semantic-complete-read-tag-analyzer):
* cedet/semantic/analyze.el (semantic-analyze-pulse):
* cedet/ede/util.el (ede-update-version-in-source):
* cedet/ede/proj.el (project-delete-target):
* cedet/ede/proj-elisp.el (ede-update-version-in-source)
(ede-proj-flush-autoconf):
* cedet/ede/pconf.el (ede-proj-configure-synchronize)
(ede-proj-configure-synchronize):
* cedet/ede/locate.el (ede-locate-file-in-project-impl):
* cedet/ede/linux.el (ede-linux-version):
* cedet/ede/emacs.el (ede-emacs-version):
* cedet/ede/dired.el (ede-dired-add-to-target):
* cedet/ede.el (ede-buffer-header-file, ede-find-target)
(ede-buffer-documentation-files, ede-project-buffers, ede-set)
(ede-target-buffers, ede-buffers, ede-make-project-local-variable):
* cedet/cedet-idutils.el (cedet-idutils-fnid-call):
(cedet-idutils-lid-call, cedet-idutils-expand-filename)
(cedet-idutils-version-check):
* cedet/cedet-global.el (cedet-gnu-global-call):
(cedet-gnu-global-expand-filename, cedet-gnu-global-root)
(cedet-gnu-global-version-check, cedet-gnu-global-scan-hits):
* cedet/cedet-cscope.el (cedet-cscope-call)
(cedet-cscope-expand-filename, cedet-cscope-version-check):
Use with-current-buffer.
* cedet/ede.el (ede-make-project-local-variable)
(ede-set-project-variables, ede-set): Use dolist.
2009-10-30 02:16:41 +00:00
|
|
|
(with-current-buffer (semanticdb-in-buffer-p obj)
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
|
|
|
|
;; Make sure all our tag lists are up to date.
|
|
|
|
(semantic-fetch-tags)
|
|
|
|
|
|
|
|
;; Try to get an accurate unmatched syntax table.
|
|
|
|
(when (and (boundp semantic-show-unmatched-syntax-mode)
|
|
|
|
semantic-show-unmatched-syntax-mode)
|
|
|
|
;; Only do this if the user runs unmatched syntax
|
2011-11-17 01:09:20 -08:00
|
|
|
;; mode display entries.
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(oset obj unmatched-syntax
|
|
|
|
(semantic-show-unmatched-lex-tokens-fetch))
|
|
|
|
)
|
|
|
|
|
|
|
|
;; Make sure pointmax is up to date
|
|
|
|
(oset obj pointmax (point-max))
|
|
|
|
))
|
|
|
|
|
|
|
|
;; Make sure that the file size and other attributes are
|
|
|
|
;; up to date.
|
|
|
|
(let ((fattr (file-attributes (semanticdb-full-filename obj))))
|
|
|
|
(oset obj fsize (nth 7 fattr))
|
|
|
|
(oset obj lastmodtime (nth 5 fattr))
|
|
|
|
)
|
|
|
|
|
|
|
|
;; Do it!
|
|
|
|
(condition-case tableerror
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-call-next-method)
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(error
|
|
|
|
(when semanticdb-data-debug-on-write-error
|
|
|
|
(require 'data-debug)
|
|
|
|
(data-debug-new-buffer (concat "*SEMANTICDB ERROR*"))
|
|
|
|
(data-debug-insert-thing obj "*" "")
|
|
|
|
(setq semanticdb-data-debug-on-write-error nil))
|
Merge with CEDET upstream (rev. 8499).
lisp/
* eieio/eieio-datadebug.el (data-debug/eieio-insert-slots):
Inhibit read only while inserting objects.
lisp/cedet/
* semantic.el (navigate-menu): Yank Tag :enable. Make sure
`senator-tag-ring' is bound.
(semantic-parse-region-default): Stop reversing the output of
parse-whole-stream.
(semantic-repeat-parse-whole-stream): Append returned tags
differently, so they come out in the right order.
* semantic/sb.el (semantic-sb-filter-tags-of-class): New option.
(semantic-sb-fetch-tag-table): Filter tags being bucketed to exclude
tags belonging to above filtered classes.
* semantic/find.el (semantic-filter-tags-by-class): New function.
* semantic/tag-ls.el (semantic-tag-similar-p-default): Add
short-circuit in case tag1 and 2 are identical.
* semantic/analyze/fcn.el
(semantic-analyze-dereference-metatype-stack): Use
`semantic-tag-similar-p' instead of 'eq' when comparing two tags
during metatype evaluation in case they are the same, but not the same
node. (Tweaked patch from Tomasz Gajewski) (Tiny change)
* semantic/db-find.el (semanticdb-partial-synchronize): Fix require to
semantic/db-typecache to be correct.
(semanticdb-find-tags-external-children-of-type): Make this a brutish
search by default.
* semantic/sort.el (semantic-tag-external-member-children-default):
When calling `semanticdb-find-tags-external-children-of-type', pass in
the input tag as the place to start searching for externally defined
methods.
* semantic/db-file.el (semanticdb-default-save-directory): Doc
fix: Add ref to default value.
* semantic/complete.el (semantic-complete-post-command-hook): When
detecting if cursor is outside completion area, do so if cursor moves
before start of overlay, or the original starting location of the
overlay (i.e., if user deletes past beginning of the overlay region).
(semantic-complete-inline-tag-engine): Initialize original start of
`semantic-complete-inline-overlay'.
* semantic/bovine/c.el (semantic-c-describe-environment): Update some
section titles. Test semanticdb table before printing it.
(semantic-c-reset-preprocessor-symbol-map): Update
`semantic-lex-spp-macro-symbol-obarray' outside the loop over all the
files contributing to its value.
(semantic-c-describe-environment): If there is an EDE project but no
spp symbols from it, say so.
* srecode/args.el (srecode-semantic-handle-:project): New argument
handler. Provide variable values if not in an EDE project.
* srecode/srt-mode.el (srecode-template-mode): Fix typo on srecode
name.
* srecode/cpp.el (srecode-semantic-handle-:c): Replace all characters
in FILENAME_SYMBOL that aren't valid CPP symbol chars.
* srecode/map.el (srecode-map-validate-file-for-mode): Force semantic
to load if it is not active in the template being added to the map.
* srecode/srt.el: Add local variables for setting the autoload file
name.
(srecode-semantic-handle-:srt): New autoload cookie
* ede.el (ede-apply-preprocessor-map): Apply map to
`semantic-lex-spp-project-macro-symbol-obarray' instead of the system
one. Add require for semantic.
* ede/proj-elisp.el (ede-update-version-in-source): In case a file has
both a version variable and a Version: comment, always use
`call-next-method'.
* ede/cpp-root.el (ede-set-project-variables): Deleted.
`ede-preprocessor-map' does the job this function was attempting to do
with :spp-table.
(ede-preprocessor-map): Update file tests to provide better messages.
Do not try to get symbols from a file that is the file in the current
buffer.
* ede/base.el (ede-project-placeholder): Add more documentation to
:file slot.
(ede-load-cache): Use `insert-file-contents' instead of
`find-file-noselect' in order to avoid activating other tools.
* semantic/bovine/c.el (semantic-get-local-variables): Also add a new
variable 'this' if we are in an inline member function. For detecting
this, we check overlays at point if there is a class spanning the
current function. Also, the variable 'this' has to be a pointer.
* semantic/bovine/gcc.el (semantic-gcc-setup): Fail gracefully when
querying g++ for defines returns an error.
* srecode/srt-mode.el:
* srecode/compile.el:
* semantic/elp.el:
* semantic/db-el.el:
* semantic/complete.el:
* ede.el:
* cogre.el:
* srecode/table.el:
* srecode/mode.el:
* srecode/insert.el:
* srecode/compile.el:
* semantic/decorate/include.el:
* semantic/db.el:
* semantic/adebug.el:
* ede/auto.el:
* srecode/dictionary.el:
* semantic/ede-grammar.el:
* semantic/db.el:
* semantic/db-find.el:
* semantic/db-file.el:
* semantic/complete.el:
* semantic/bovine/c.el:
* semantic/analyze.el:
* ede/util.el:
* ede/proj.el:
* ede/proj-elisp.el:
* ede/pconf.el:
* ede/locate.el:
* ede.el: Adapt to EIEIO namespace cleanup: Rename `object-name' to
`eieio-object-name', `object-set-name-string' to
`eieio-object-set-name-string', `object-class' to
`eieio-object-class', `class-parent' to `eieio-class-parent',
`class-parents' to `eieio-class-parents', `class-children' to
`eieio-class-children', `object-name-string' to
`eieio-object-name-string', `object-class-fast' to
`eieio--object-class'. Also replace direct access with new accessor
functions.
* ede/cpp-root.el (ede-project-autoload, initialize-instance): Fix EDE
file symbol to match rename. Fix ede-cpp-root symbol to include
-project in name.
* cedet-files.el (cedet-files-list-recursively): New function.
Recursively find files whose names are matching to given regex
* ede.el (ede-current-project): Rewrite to avoid imperative style.
* ede/files.el (ede-find-file): Simplify code.
* ede/base.el (ede-normalize-file/directory): Add function to
normalize :file or :directory slots if they are missing.
* ede/cpp-root.el (ede-cpp-root-project): Add compile-command slot.
(project-compile-project): Compiles project using value specified in
:compule-command slot or in compile-command local variable. Value of
slot or local variable could be string or function that receives
project and should return string that will be invoked as command.
(project-compile-target): Invokes compilation of whole project
* ede/files.el (ede-find-project-root): New function to find root of
project that contains specific file.
(ede-files-find-existing): New function which checks presence of given
directory in the list of registered projects.
etc/
* srecode/ede-autoconf.srt: Change Copyright to FSF.
(ede-empty): Change AC_INIT to use PROJECT_NAME, and PROJECT_VERSION.
* srecode/ede-make.srt (ede-empty): Add a dependency on :project. Add
header comment specifying the project's relative path.
* srecode/c.srt (header_guard): Upcase the filename symbol.
* srecode/java.srt (empty-main): New.
(class-tag): Decapitalize class.
2013-03-21 23:11:03 +01:00
|
|
|
(message "Error Writing Table: %s" (eieio-object-name obj))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
(error "%S" (car (cdr tableerror)))))
|
|
|
|
|
|
|
|
;; Clear the dirty bit.
|
|
|
|
(oset obj dirty nil)
|
|
|
|
))
|
|
|
|
|
|
|
|
;;; State queries
|
|
|
|
;;
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-write-directory-p ((obj semanticdb-project-database-file))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"Return non-nil if OBJ should be written to disk.
|
|
|
|
Uses `semanticdb-persistent-path' to determine the return value."
|
|
|
|
(let ((path semanticdb-persistent-path))
|
|
|
|
(catch 'found
|
|
|
|
(while path
|
|
|
|
(cond ((stringp (car path))
|
|
|
|
(if (string= (oref obj reference-directory) (car path))
|
|
|
|
(throw 'found t)))
|
|
|
|
((eq (car path) 'project)
|
|
|
|
;; @TODO - EDE causes us to go in here and disable
|
|
|
|
;; the old default 'always save' setting.
|
|
|
|
;;
|
|
|
|
;; With new default 'always' should I care?
|
|
|
|
(if semanticdb-project-predicate-functions
|
|
|
|
(if (run-hook-with-args-until-success
|
|
|
|
'semanticdb-project-predicate-functions
|
|
|
|
(oref obj reference-directory))
|
|
|
|
(throw 'found t))
|
|
|
|
;; If the mode is 'project, and there are no project
|
|
|
|
;; modes, then just always save the file. If users
|
|
|
|
;; wish to restrict the search, modify
|
|
|
|
;; `semanticdb-persistent-path' to include desired paths.
|
|
|
|
(if (= (length semanticdb-persistent-path) 1)
|
|
|
|
(throw 'found t))
|
|
|
|
))
|
|
|
|
((eq (car path) 'never)
|
|
|
|
(throw 'found nil))
|
|
|
|
((eq (car path) 'always)
|
|
|
|
(throw 'found t))
|
|
|
|
(t (error "Invalid path %S" (car path))))
|
|
|
|
(setq path (cdr path)))
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-call-next-method))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
;;; Filename manipulation
|
|
|
|
;;
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-file-table ((obj semanticdb-project-database-file) filename)
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"From OBJ, return FILENAME's associated table object."
|
|
|
|
;; Cheater option. In this case, we always have files directly
|
|
|
|
;; under ourselves. The main project type may not.
|
|
|
|
(object-assoc (file-name-nondirectory filename) 'file (oref obj tables)))
|
|
|
|
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-file-name-non-directory
|
|
|
|
((dbclass (subclass semanticdb-project-database-file)))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"Return the file name DBCLASS will use.
|
|
|
|
File name excludes any directory part."
|
|
|
|
semanticdb-default-file-name)
|
|
|
|
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-file-name-directory
|
|
|
|
((dbclass (subclass semanticdb-project-database-file)) directory)
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"Return the relative directory to where DBCLASS will save its cache file.
|
|
|
|
The returned path is related to DIRECTORY."
|
|
|
|
(if semanticdb-default-save-directory
|
|
|
|
(let ((file (cedet-directory-name-to-file-name directory)))
|
|
|
|
;; Now create a filename for the cache file in
|
|
|
|
;; ;`semanticdb-default-save-directory'.
|
|
|
|
(expand-file-name
|
|
|
|
file (file-name-as-directory semanticdb-default-save-directory)))
|
|
|
|
directory))
|
|
|
|
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-cache-filename
|
|
|
|
((dbclass (subclass semanticdb-project-database-file)) path)
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"For DBCLASS, return a file to a cache file belonging to PATH.
|
|
|
|
This could be a cache file in the current directory, or an encoded file
|
|
|
|
name in a secondary directory."
|
|
|
|
;; Use concat and not expand-file-name, because the dir part
|
|
|
|
;; may include some of the file name.
|
|
|
|
(concat (semanticdb-file-name-directory dbclass path)
|
|
|
|
(semanticdb-file-name-non-directory dbclass)))
|
|
|
|
|
2015-02-04 13:49:49 -05:00
|
|
|
(cl-defmethod semanticdb-full-filename ((obj semanticdb-project-database-file))
|
cedet/semantic/adebug.el, cedet/semantic/chart.el,
cedet/semantic/db-debug.el, cedet/semantic/db-ebrowse.el,
cedet/semantic/db-el.el, cedet/semantic/db-file.el,
cedet/semantic/db-javascript.el, cedet/semantic/db-search.el,
cedet/semantic/db-typecache.el, cedet/semantic/dep.el,
cedet/semantic/ia.el, cedet/semantic/tag-file.el,
cedet/semantic/tag-ls.el: New files.
2009-08-29 19:32:33 +00:00
|
|
|
"Fetch the full filename that OBJ refers to."
|
|
|
|
(oref obj file))
|
|
|
|
|
|
|
|
;;; FLUSH OLD FILES
|
|
|
|
;;
|
|
|
|
(defun semanticdb-cleanup-cache-files (&optional noerror)
|
|
|
|
"Cleanup any cache files associated with directories that no longer exist.
|
|
|
|
Optional NOERROR prevents errors from being displayed."
|
|
|
|
(interactive)
|
|
|
|
(when (and (not semanticdb-default-save-directory)
|
|
|
|
(not noerror))
|
|
|
|
(error "No default save directory for semantic-save files"))
|
|
|
|
|
|
|
|
(when semanticdb-default-save-directory
|
|
|
|
|
|
|
|
;; Calculate all the cache files we have.
|
|
|
|
(let* ((regexp (regexp-quote semanticdb-default-file-name))
|
|
|
|
(files (directory-files semanticdb-default-save-directory
|
|
|
|
t regexp))
|
|
|
|
(orig nil)
|
|
|
|
(to-delete nil))
|
|
|
|
(dolist (F files)
|
|
|
|
(setq orig (cedet-file-name-to-directory-name
|
|
|
|
(file-name-nondirectory F)))
|
|
|
|
(when (not (file-exists-p (file-name-directory orig)))
|
|
|
|
(setq to-delete (cons F to-delete))
|
|
|
|
))
|
|
|
|
(if to-delete
|
|
|
|
(save-window-excursion
|
|
|
|
(let ((buff (get-buffer-create "*Semanticdb Delete*")))
|
|
|
|
(with-current-buffer buff
|
|
|
|
(erase-buffer)
|
|
|
|
(insert "The following Cache files appear to be obsolete.\n\n")
|
|
|
|
(dolist (F to-delete)
|
|
|
|
(insert F "\n")))
|
|
|
|
(pop-to-buffer buff t t)
|
|
|
|
(fit-window-to-buffer (get-buffer-window buff) nil 1)
|
|
|
|
(when (y-or-n-p "Delete Old Cache Files? ")
|
|
|
|
(mapc (lambda (F)
|
|
|
|
(message "Deleting to %s..." F)
|
|
|
|
(delete-file F))
|
|
|
|
to-delete)
|
|
|
|
(message "done."))
|
|
|
|
))
|
|
|
|
;; No files to delete
|
|
|
|
(when (not noerror)
|
|
|
|
(message "No obsolete semanticdb.cache files."))
|
|
|
|
))))
|
|
|
|
|
|
|
|
(provide 'semantic/db-file)
|
|
|
|
|
2009-09-07 17:59:16 +00:00
|
|
|
;; Local variables:
|
|
|
|
;; generated-autoload-file: "loaddefs.el"
|
|
|
|
;; generated-autoload-load-name: "semantic/db-file"
|
|
|
|
;; End:
|
|
|
|
|
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-ebrowse.el: Don't require semantic/db-mode, since
semanticdb-current-database and semanticdb-current-table are now in
semantic/db.el.
cedet/semantic/db-el.el: Require semantic/lex-spp.
Require semantic/db instead of semantic/db-search.
cedet/semantic/db-file.el: Declare inversion-test and
data-debug-insert-thing.
(semanticdb-load-database): Load inversion only if necessary.
cedet/semantic/db-find.el: Autoload semanticdb-find-default-throttle.
Defvar data-debug-thing-alist, and ede-current-project.
Declare data-debug-insert-stuff-list, data-debug-insert-tag-list,
semantic-scope-reset-cache, and semanticdb-typecache-notify-reset.
Require semantic/tag-file, and semantic/sort.
(semantic-reset): Require semantic/scope.
(semanticdb-partial-synchronize): Require semantic/db-typecache.
(semanticdb-find-table-for-include) Move up to avoid compiler warning.
cedet/semantic/db-global.el: Declare data-debug-new-buffer and
data-debug-insert-thing.
(semanticdb-project-database-global) Move up to avoid compiler warning.
cedet/semantic/db-javascript.el: Fix provide statement.
Require semantic/db-find instead of semantic/db-search.
cedet/semantic/db-mode.el: Declare semantic-lex-spp-set-dynamic-table.
(semanticdb-current-database, semanticdb-current-table): Move into
semantic/db.el
cedet/semantic/db-ref.el: Require eieio, semantic/db, and semantic/util.
Declare data-debug-new-buffer and data-debug-insert-object-slots.
Defvar semantic-case-fold. Require semantic/find when compiling.
cedet/semantic/db-typecache.el: Require semantic/tag-ls,
semantic/analyze/fcn, and semantic/scope. Declare
data-debug-insert-thing and data-debug-new-buffer.
cedet/semantic/db.el (semanticdb-search-results-table): Move class
definition here from semantic/db-search.el.
(semanticdb-current-database, semanticdb-current-table) Move variable
definitions here from semantic/db-mode.el.
2009-08-31 00:45:41 +00:00
|
|
|
;;; semantic/db-file.el ends here
|