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.el --- Semantic tag database manager
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
2013-01-01 09:11:05 +00:00
|
|
|
|
;; Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
2009-08-28 15:19:20 +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:
|
|
|
|
|
;;
|
|
|
|
|
;; Maintain a database of tags for a group of files and enable
|
|
|
|
|
;; queries into the database.
|
|
|
|
|
;;
|
|
|
|
|
;; By default, assume one database per directory.
|
|
|
|
|
;;
|
|
|
|
|
|
2009-09-28 15:15:00 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(require 'eieio-base)
|
|
|
|
|
(require 'semantic)
|
2009-09-28 15:15:00 +00:00
|
|
|
|
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(require 'semantic/find))
|
|
|
|
|
|
2009-09-28 15:15:00 +00:00
|
|
|
|
(declare-function semantic-lex-spp-save-table "semantic/lex-spp")
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
2012-10-02 02:10:29 +08:00
|
|
|
|
;; Use autoload to avoid recursive require of semantic/db-ref
|
|
|
|
|
(autoload 'semanticdb-refresh-references "semantic/db-ref"
|
|
|
|
|
"Refresh references to DBT in other files.")
|
|
|
|
|
|
2009-08-28 15:19:20 +00:00
|
|
|
|
;;; Variables:
|
|
|
|
|
(defgroup semanticdb nil
|
|
|
|
|
"Parser Generator Persistent Database interface."
|
2009-09-28 15:15:00 +00:00
|
|
|
|
:group 'semantic)
|
|
|
|
|
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(defvar semanticdb-database-list nil
|
|
|
|
|
"List of all active databases.")
|
|
|
|
|
|
|
|
|
|
(defvar semanticdb-new-database-class 'semanticdb-project-database-file
|
|
|
|
|
"The default type of database created for new files.
|
|
|
|
|
This can be changed on a per file basis, so that some directories
|
|
|
|
|
are saved using one mechanism, and some directories via a different
|
|
|
|
|
mechanism.")
|
|
|
|
|
(make-variable-buffer-local 'semanticdb-new-database-class)
|
|
|
|
|
|
|
|
|
|
(defvar semanticdb-default-find-index-class 'semanticdb-find-search-index
|
|
|
|
|
"The default type of search index to use for a `semanticdb-table's.
|
2009-10-01 04:54:05 +00:00
|
|
|
|
This can be changed to try out new types of search indices.")
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(make-variable-buffer-local 'semanticdb-default-find=index-class)
|
|
|
|
|
|
2009-09-02 04:37:10 +00:00
|
|
|
|
;;;###autoload
|
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
|
|
|
|
(defvar semanticdb-current-database nil
|
|
|
|
|
"For a given buffer, this is the currently active database.")
|
|
|
|
|
(make-variable-buffer-local 'semanticdb-current-database)
|
|
|
|
|
|
2009-09-02 04:37:10 +00:00
|
|
|
|
;;;###autoload
|
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
|
|
|
|
(defvar semanticdb-current-table nil
|
|
|
|
|
"For a given buffer, this is the currently active database table.")
|
|
|
|
|
(make-variable-buffer-local 'semanticdb-current-table)
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
|
|
|
|
;;; ABSTRACT CLASSES
|
|
|
|
|
;;
|
|
|
|
|
(defclass semanticdb-abstract-table ()
|
|
|
|
|
((parent-db ;; :initarg :parent-db
|
|
|
|
|
;; Do not set an initarg, or you get circular writes to disk.
|
|
|
|
|
:documentation "Database Object containing this table.")
|
|
|
|
|
(major-mode :initarg :major-mode
|
|
|
|
|
:initform nil
|
|
|
|
|
:documentation "Major mode this table belongs to.
|
|
|
|
|
Sometimes it is important for a program to know if a given table has the
|
|
|
|
|
same major mode as the current buffer.")
|
|
|
|
|
(tags :initarg :tags
|
|
|
|
|
:accessor semanticdb-get-tags
|
|
|
|
|
:printer semantic-tag-write-list-slot-value
|
|
|
|
|
:documentation "The tags belonging to this table.")
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(db-refs :initform nil
|
|
|
|
|
:documentation
|
|
|
|
|
"List of `semanticdb-table' objects refering to this one.
|
|
|
|
|
These aren't saved, but are instead recalculated after load.
|
|
|
|
|
See the file semanticdb-ref.el for how this slot is used.")
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(index :type semanticdb-abstract-search-index
|
|
|
|
|
:documentation "The search index.
|
|
|
|
|
Used by semanticdb-find to store additional information about
|
|
|
|
|
this table for searching purposes.
|
|
|
|
|
|
|
|
|
|
Note: This index will not be saved in a persistent file.")
|
|
|
|
|
(cache :type list
|
|
|
|
|
:initform nil
|
|
|
|
|
:documentation "List of cache information for tools.
|
|
|
|
|
Any particular tool can cache data to a database at runtime
|
|
|
|
|
with `semanticdb-cache-get'.
|
|
|
|
|
|
|
|
|
|
Using a semanticdb cache does not save any information to a file,
|
|
|
|
|
so your cache will need to be recalculated at runtime. Caches can be
|
|
|
|
|
referenced even when the file is not in a buffer.
|
|
|
|
|
|
|
|
|
|
Note: This index will not be saved in a persistent file.")
|
|
|
|
|
)
|
|
|
|
|
"A simple table for semantic tags.
|
|
|
|
|
This table is the root of tables, and contains the minimum needed
|
|
|
|
|
for a new table not associated with a buffer."
|
|
|
|
|
:abstract t)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-in-buffer-p ((obj semanticdb-abstract-table))
|
|
|
|
|
"Return a nil, meaning abstract table OBJ is not in a buffer."
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-get-buffer ((obj semanticdb-abstract-table))
|
|
|
|
|
"Return a buffer associated with OBJ.
|
|
|
|
|
If the buffer is not in memory, load it with `find-file-noselect'."
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-full-filename ((obj semanticdb-abstract-table))
|
|
|
|
|
"Fetch the full filename that OBJ refers to.
|
|
|
|
|
Abstract tables do not have file names associated with them."
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-dirty-p ((obj semanticdb-abstract-table))
|
|
|
|
|
"Return non-nil if OBJ is 'dirty'."
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-set-dirty ((obj semanticdb-abstract-table))
|
|
|
|
|
"Mark the abstract table OBJ dirty.
|
|
|
|
|
Abstract tables can not be marked dirty, as there is nothing
|
|
|
|
|
for them to synchronize against."
|
|
|
|
|
;; The abstract table can not be dirty.
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-normalize-tags ((obj semanticdb-abstract-table) tags)
|
|
|
|
|
"For the table OBJ, convert a list of TAGS, into standardized form.
|
|
|
|
|
The default is to return TAGS.
|
|
|
|
|
Some databases may default to searching and providing simplified tags
|
|
|
|
|
based on whichever technique used. This method provides a hook for
|
|
|
|
|
them to convert TAG into a more complete form."
|
|
|
|
|
tags)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-normalize-one-tag ((obj semanticdb-abstract-table) tag)
|
|
|
|
|
"For the table OBJ, convert a TAG, into standardized form.
|
|
|
|
|
This method returns a list of the form (DATABASE . NEWTAG).
|
|
|
|
|
|
|
|
|
|
The default is to just return (OBJ TAG).
|
|
|
|
|
|
|
|
|
|
Some databases may default to searching and providing simplified tags
|
|
|
|
|
based on whichever technique used. This method provides a hook for
|
|
|
|
|
them to convert TAG into a more complete form."
|
|
|
|
|
(cons obj tag))
|
|
|
|
|
|
|
|
|
|
(defmethod object-print ((obj semanticdb-abstract-table) &rest strings)
|
2012-10-02 02:10:29 +08:00
|
|
|
|
"Pretty printer extension for `semanticdb-abstract-table'.
|
2009-08-28 15:19:20 +00:00
|
|
|
|
Adds the number of tags in this file to the object print name."
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(if (or (not strings)
|
|
|
|
|
(and (= (length strings) 1) (stringp (car strings))
|
|
|
|
|
(string= (car strings) "")))
|
|
|
|
|
;; Else, add a tags quantifier.
|
|
|
|
|
(call-next-method obj (format " (%d tags)" (length (semanticdb-get-tags obj))))
|
|
|
|
|
;; Pass through.
|
|
|
|
|
(apply 'call-next-method obj strings)
|
|
|
|
|
))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
|
|
|
|
;;; Index Cache
|
|
|
|
|
;;
|
|
|
|
|
(defclass semanticdb-abstract-search-index ()
|
|
|
|
|
((table :initarg :table
|
|
|
|
|
:type semanticdb-abstract-table
|
|
|
|
|
:documentation "XRef to the table this belongs to.")
|
|
|
|
|
)
|
|
|
|
|
"A place where semanticdb-find can store search index information.
|
|
|
|
|
The search index will store data about which other tables might be
|
|
|
|
|
needed, or perhaps create hash or index tables for the current buffer."
|
|
|
|
|
:abstract t)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-get-table-index ((obj semanticdb-abstract-table))
|
|
|
|
|
"Return the search index for the table OBJ.
|
|
|
|
|
If one doesn't exist, create it."
|
|
|
|
|
(if (slot-boundp obj 'index)
|
|
|
|
|
(oref obj index)
|
|
|
|
|
(let ((idx nil))
|
|
|
|
|
(setq idx (funcall semanticdb-default-find-index-class
|
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
|
|
|
|
(concat (eieio-object-name obj) " index")
|
2009-08-28 15:19:20 +00:00
|
|
|
|
;; Fill in the defaults
|
|
|
|
|
:table obj
|
|
|
|
|
))
|
|
|
|
|
(oset obj index idx)
|
|
|
|
|
idx)))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-synchronize ((idx semanticdb-abstract-search-index)
|
|
|
|
|
new-tags)
|
|
|
|
|
"Synchronize the search index IDX with some NEW-TAGS."
|
|
|
|
|
;; The abstract class will do... NOTHING!
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-partial-synchronize ((idx semanticdb-abstract-search-index)
|
|
|
|
|
new-tags)
|
|
|
|
|
"Synchronize the search index IDX with some changed NEW-TAGS."
|
|
|
|
|
;; The abstract class will do... NOTHING!
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2009-08-31 14:51:12 +00:00
|
|
|
|
;;; SEARCH RESULTS TABLE
|
|
|
|
|
;;
|
|
|
|
|
;; Needed for system databases that may not provide
|
|
|
|
|
;; a semanticdb-table associated with a file.
|
|
|
|
|
;;
|
|
|
|
|
(defclass semanticdb-search-results-table (semanticdb-abstract-table)
|
2012-10-02 02:10:29 +08:00
|
|
|
|
()
|
2009-08-31 14:51:12 +00:00
|
|
|
|
"Table used for search results when there is no file or table association.
|
|
|
|
|
Examples include search results from external sources such as from
|
2012-02-28 00:17:21 -08:00
|
|
|
|
Emacs's own symbol table, or from external libraries.")
|
2009-08-31 14:51:12 +00:00
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-refresh-table ((obj semanticdb-search-results-table) &optional force)
|
|
|
|
|
"If the tag list associated with OBJ is loaded, refresh it.
|
|
|
|
|
This will call `semantic-fetch-tags' if that file is in memory."
|
|
|
|
|
nil)
|
|
|
|
|
|
2009-08-28 15:19:20 +00:00
|
|
|
|
;;; CONCRETE TABLE CLASSES
|
|
|
|
|
;;
|
|
|
|
|
(defclass semanticdb-table (semanticdb-abstract-table)
|
|
|
|
|
((file :initarg :file
|
|
|
|
|
:documentation "File name relative to the parent database.
|
|
|
|
|
This is for the file whose tags are stored in this TABLE object.")
|
|
|
|
|
(buffer :initform nil
|
|
|
|
|
:documentation "The buffer associated with this table.
|
|
|
|
|
If nil, the table's buffer is no in Emacs. If it has a value, then
|
|
|
|
|
it is in Emacs.")
|
|
|
|
|
(dirty :initform nil
|
|
|
|
|
:documentation
|
|
|
|
|
"Non nil if this table needs to be `Saved'.")
|
|
|
|
|
(db-refs :initform nil
|
|
|
|
|
:documentation
|
2011-12-14 13:05:20 -08:00
|
|
|
|
"List of `semanticdb-table' objects referring to this one.
|
2009-08-28 15:19:20 +00:00
|
|
|
|
These aren't saved, but are instead recalculated after load.
|
2011-11-03 21:03:45 +01:00
|
|
|
|
See the file semantic/db-ref.el for how this slot is used.")
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(pointmax :initarg :pointmax
|
|
|
|
|
:initform nil
|
|
|
|
|
:documentation "Size of buffer when written to disk.
|
|
|
|
|
Checked on retrieval to make sure the file is the same.")
|
|
|
|
|
(fsize :initarg :fsize
|
|
|
|
|
:initform nil
|
|
|
|
|
:documentation "Size of the file when it was last referenced.
|
|
|
|
|
Checked when deciding if a loaded table needs updating from changes
|
|
|
|
|
outside of Semantic's control.")
|
|
|
|
|
(lastmodtime :initarg :lastmodtime
|
|
|
|
|
:initform nil
|
|
|
|
|
:documentation "Last modification time of the file referenced.
|
|
|
|
|
Checked when deciding if a loaded table needs updating from changes outside of
|
|
|
|
|
Semantic's control.")
|
|
|
|
|
;; @todo - need to add `last parsed time', so we can also have
|
|
|
|
|
;; refresh checks if spp tables or the parser gets rebuilt.
|
|
|
|
|
(unmatched-syntax :initarg :unmatched-syntax
|
|
|
|
|
:documentation
|
|
|
|
|
"List of vectors specifying unmatched syntax.")
|
|
|
|
|
|
|
|
|
|
(lexical-table :initarg :lexical-table
|
|
|
|
|
:initform nil
|
|
|
|
|
:printer semantic-lex-spp-table-write-slot-value
|
|
|
|
|
:documentation
|
|
|
|
|
"Table that might be needed by the lexical analyzer.
|
|
|
|
|
For C/C++, the C preprocessor macros can be saved here.")
|
|
|
|
|
)
|
|
|
|
|
"A single table of tags derived from file.")
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-in-buffer-p ((obj semanticdb-table))
|
|
|
|
|
"Return a buffer associated with OBJ.
|
|
|
|
|
If the buffer is in memory, return that buffer."
|
|
|
|
|
(let ((buff (oref obj buffer)))
|
|
|
|
|
(if (buffer-live-p buff)
|
|
|
|
|
buff
|
|
|
|
|
(oset obj buffer nil))))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-get-buffer ((obj semanticdb-table))
|
|
|
|
|
"Return a buffer associated with OBJ.
|
|
|
|
|
If the buffer is in memory, return that buffer.
|
|
|
|
|
If the buffer is not in memory, load it with `find-file-noselect'."
|
|
|
|
|
(or (semanticdb-in-buffer-p obj)
|
2009-09-19 17:25:30 +00:00
|
|
|
|
;; Save match data to protect against odd stuff in mode hooks.
|
|
|
|
|
(save-match-data
|
|
|
|
|
(find-file-noselect (semanticdb-full-filename obj) t))))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-set-buffer ((obj semanticdb-table))
|
|
|
|
|
"Set the current buffer to be a buffer owned by OBJ.
|
|
|
|
|
If OBJ's file is not loaded, read it in first."
|
|
|
|
|
(set-buffer (semanticdb-get-buffer obj)))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-full-filename ((obj semanticdb-table))
|
|
|
|
|
"Fetch the full filename that OBJ refers to."
|
|
|
|
|
(expand-file-name (oref obj file)
|
|
|
|
|
(oref (oref obj parent-db) reference-directory)))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-dirty-p ((obj semanticdb-table))
|
|
|
|
|
"Return non-nil if OBJ is 'dirty'."
|
|
|
|
|
(oref obj dirty))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-set-dirty ((obj semanticdb-table))
|
|
|
|
|
"Mark the abstract table OBJ dirty."
|
|
|
|
|
(oset obj dirty t)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defmethod object-print ((obj semanticdb-table) &rest strings)
|
|
|
|
|
"Pretty printer extension for `semanticdb-table'.
|
|
|
|
|
Adds the number of tags in this file to the object print name."
|
|
|
|
|
(apply 'call-next-method obj
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(cons (format " (%d tags)" (length (semanticdb-get-tags obj)))
|
|
|
|
|
(cons (if (oref obj dirty) ", DIRTY" "") strings))))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
|
|
|
|
;;; DATABASE BASE CLASS
|
|
|
|
|
;;
|
|
|
|
|
(defclass semanticdb-project-database (eieio-instance-tracker)
|
|
|
|
|
((tracking-symbol :initform semanticdb-database-list)
|
|
|
|
|
(reference-directory :type string
|
|
|
|
|
:documentation "Directory this database refers to.
|
|
|
|
|
When a cache directory is specified, then this refers to the directory
|
|
|
|
|
this database contains symbols for.")
|
|
|
|
|
(new-table-class :initform semanticdb-table
|
|
|
|
|
:type class
|
|
|
|
|
:documentation
|
|
|
|
|
"New tables created for this database are of this class.")
|
|
|
|
|
(cache :type list
|
|
|
|
|
:initform nil
|
|
|
|
|
:documentation "List of cache information for tools.
|
|
|
|
|
Any particular tool can cache data to a database at runtime
|
|
|
|
|
with `semanticdb-cache-get'.
|
|
|
|
|
|
|
|
|
|
Using a semanticdb cache does not save any information to a file,
|
|
|
|
|
so your cache will need to be recalculated at runtime.
|
|
|
|
|
|
|
|
|
|
Note: This index will not be saved in a persistent file.")
|
|
|
|
|
(tables :initarg :tables
|
2012-10-02 02:10:29 +08:00
|
|
|
|
:type semanticdb-abstract-table-list
|
2009-08-28 15:19:20 +00:00
|
|
|
|
;; Need this protection so apps don't try to access
|
|
|
|
|
;; the tables without using the accessor.
|
|
|
|
|
:accessor semanticdb-get-database-tables
|
|
|
|
|
:protection :protected
|
|
|
|
|
:documentation "List of `semantic-db-table' objects."))
|
|
|
|
|
"Database of file tables.")
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-full-filename ((obj semanticdb-project-database))
|
|
|
|
|
"Fetch the full filename that OBJ refers to.
|
|
|
|
|
Abstract tables do not have file names associated with them."
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-dirty-p ((DB semanticdb-project-database))
|
|
|
|
|
"Return non-nil if DB is 'dirty'.
|
|
|
|
|
A database is dirty if the state of the database changed in a way
|
|
|
|
|
where it may need to resynchronize with some persistent storage."
|
|
|
|
|
(let ((dirty nil)
|
|
|
|
|
(tabs (oref DB tables)))
|
|
|
|
|
(while (and (not dirty) tabs)
|
|
|
|
|
(setq dirty (semanticdb-dirty-p (car tabs)))
|
|
|
|
|
(setq tabs (cdr tabs)))
|
|
|
|
|
dirty))
|
|
|
|
|
|
|
|
|
|
(defmethod object-print ((obj semanticdb-project-database) &rest strings)
|
|
|
|
|
"Pretty printer extension for `semanticdb-project-database'.
|
|
|
|
|
Adds the number of tables in this file to the object print name."
|
|
|
|
|
(apply 'call-next-method obj
|
|
|
|
|
(cons (format " (%d tables%s)"
|
|
|
|
|
(length (semanticdb-get-database-tables obj))
|
|
|
|
|
(if (semanticdb-dirty-p obj)
|
|
|
|
|
" DIRTY" "")
|
|
|
|
|
)
|
|
|
|
|
strings)))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-create-database :STATIC ((dbc semanticdb-project-database) directory)
|
|
|
|
|
"Create a new semantic database of class DBC for DIRECTORY and return it.
|
|
|
|
|
If a database for DIRECTORY has already been created, return it.
|
|
|
|
|
If DIRECTORY doesn't exist, create a new one."
|
|
|
|
|
(let ((db (semanticdb-directory-loaded-p directory)))
|
|
|
|
|
(unless db
|
|
|
|
|
(setq db (semanticdb-project-database
|
|
|
|
|
(file-name-nondirectory directory)
|
|
|
|
|
:tables nil))
|
|
|
|
|
;; 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 (file-truename directory)))
|
|
|
|
|
db))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-flush-database-tables ((db semanticdb-project-database))
|
|
|
|
|
"Reset the tables in DB to be empty."
|
|
|
|
|
(oset db tables nil))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-create-table ((db semanticdb-project-database) file)
|
|
|
|
|
"Create a new table in DB for FILE and return it.
|
|
|
|
|
The class of DB contains the class name for the type of table to create.
|
|
|
|
|
If the table for FILE exists, return it.
|
|
|
|
|
If the table for FILE does not exist, create one."
|
|
|
|
|
(let ((newtab (semanticdb-file-table db file)))
|
|
|
|
|
(unless newtab
|
|
|
|
|
;; This implementation will satisfy autoloaded classes
|
|
|
|
|
;; for tables.
|
|
|
|
|
(setq newtab (funcall (oref db new-table-class)
|
|
|
|
|
(file-name-nondirectory file)
|
|
|
|
|
:file (file-name-nondirectory file)
|
|
|
|
|
))
|
|
|
|
|
(oset newtab parent-db db)
|
|
|
|
|
(object-add-to-list db 'tables newtab t))
|
|
|
|
|
newtab))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-file-table ((obj semanticdb-project-database) filename)
|
|
|
|
|
"From OBJ, return FILENAME's associated table object."
|
|
|
|
|
(object-assoc (file-relative-name (file-truename filename)
|
|
|
|
|
(oref obj reference-directory))
|
|
|
|
|
'file (oref obj tables)))
|
|
|
|
|
|
|
|
|
|
;; DATABASE FUNCTIONS
|
|
|
|
|
(defun semanticdb-get-database (filename)
|
|
|
|
|
"Get a database for FILENAME.
|
|
|
|
|
If one isn't found, create one."
|
|
|
|
|
(semanticdb-create-database semanticdb-new-database-class (file-truename filename)))
|
|
|
|
|
|
|
|
|
|
(defun semanticdb-directory-loaded-p (path)
|
|
|
|
|
"Return the project belonging to PATH if it was already loaded."
|
|
|
|
|
(eieio-instance-tracker-find path 'reference-directory 'semanticdb-database-list))
|
|
|
|
|
|
|
|
|
|
(defun semanticdb-create-table-for-file (filename)
|
|
|
|
|
"Initialize a database table for FILENAME, and return it.
|
|
|
|
|
If FILENAME exists in the database already, return that.
|
|
|
|
|
If there is no database for the table to live in, create one."
|
|
|
|
|
(let ((cdb nil)
|
|
|
|
|
(tbl nil)
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(dd (file-name-directory (file-truename filename)))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
)
|
|
|
|
|
;; Allow a database override function
|
|
|
|
|
(setq cdb (semanticdb-create-database semanticdb-new-database-class
|
|
|
|
|
dd))
|
|
|
|
|
;; Get a table for this file.
|
|
|
|
|
(setq tbl (semanticdb-create-table cdb filename))
|
|
|
|
|
|
|
|
|
|
;; Return the pair.
|
|
|
|
|
(cons cdb tbl)
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
;;; Cache Cache.
|
|
|
|
|
;;
|
|
|
|
|
(defclass semanticdb-abstract-cache ()
|
|
|
|
|
((table :initarg :table
|
|
|
|
|
:type semanticdb-abstract-table
|
|
|
|
|
:documentation
|
|
|
|
|
"Cross reference to the table this belongs to.")
|
|
|
|
|
)
|
|
|
|
|
"Abstract baseclass for tools to use to cache information in semanticdb.
|
|
|
|
|
Tools needing a per-file cache must subclass this, and then get one as
|
|
|
|
|
needed. Cache objects are identified in semanticdb by subclass.
|
|
|
|
|
In order to keep your cache up to date, be sure to implement
|
|
|
|
|
`semanticdb-synchronize', and `semanticdb-partial-synchronize'.
|
2011-11-03 21:03:45 +01:00
|
|
|
|
See the file semantic/scope.el for an example."
|
2009-08-28 15:19:20 +00:00
|
|
|
|
:abstract t)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-cache-get ((table semanticdb-abstract-table)
|
|
|
|
|
desired-class)
|
|
|
|
|
"Get a cache object on TABLE of class DESIRED-CLASS.
|
|
|
|
|
This method will create one if none exists with no init arguments
|
|
|
|
|
other than :table."
|
2009-12-14 04:17:00 +00:00
|
|
|
|
(unless (child-of-class-p desired-class 'semanticdb-abstract-cache)
|
|
|
|
|
(error "Invalid SemanticDB cache"))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(let ((cache (oref table cache))
|
|
|
|
|
(obj nil))
|
|
|
|
|
(while (and (not obj) cache)
|
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
|
|
|
|
(if (eq (eieio--object-class (car cache)) desired-class)
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(setq obj (car cache)))
|
|
|
|
|
(setq cache (cdr cache)))
|
|
|
|
|
(if obj
|
|
|
|
|
obj ;; Just return it.
|
2011-11-15 18:37:37 +01:00
|
|
|
|
;; No object, let's create a new one and return that.
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(setq obj (funcall desired-class "Cache" :table table))
|
|
|
|
|
(object-add-to-list table 'cache obj)
|
|
|
|
|
obj)))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-cache-remove ((table semanticdb-abstract-table)
|
|
|
|
|
cache)
|
|
|
|
|
"Remove from TABLE the cache object CACHE."
|
|
|
|
|
(object-remove-from-list table 'cache cache))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-synchronize ((cache semanticdb-abstract-cache)
|
|
|
|
|
new-tags)
|
|
|
|
|
"Synchronize a CACHE with some NEW-TAGS."
|
|
|
|
|
;; The abstract class will do... NOTHING!
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-partial-synchronize ((cache semanticdb-abstract-cache)
|
|
|
|
|
new-tags)
|
|
|
|
|
"Synchronize a CACHE with some changed NEW-TAGS."
|
|
|
|
|
;; The abstract class will do... NOTHING!
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defclass semanticdb-abstract-db-cache ()
|
|
|
|
|
((db :initarg :db
|
|
|
|
|
:type semanticdb-project-database
|
|
|
|
|
:documentation
|
|
|
|
|
"Cross reference to the database this belongs to.")
|
|
|
|
|
)
|
|
|
|
|
"Abstract baseclass for tools to use to cache information in semanticdb.
|
|
|
|
|
Tools needing a database cache must subclass this, and then get one as
|
|
|
|
|
needed. Cache objects are identified in semanticdb by subclass.
|
|
|
|
|
In order to keep your cache up to date, be sure to implement
|
|
|
|
|
`semanticdb-synchronize', and `semanticdb-partial-synchronize'.
|
2011-11-03 21:03:45 +01:00
|
|
|
|
See the file semantic/scope.el for an example."
|
2009-08-28 15:19:20 +00:00
|
|
|
|
:abstract t)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-cache-get ((db semanticdb-project-database)
|
|
|
|
|
desired-class)
|
|
|
|
|
"Get a cache object on DB of class DESIRED-CLASS.
|
|
|
|
|
This method will create one if none exists with no init arguments
|
|
|
|
|
other than :table."
|
2009-12-14 04:17:00 +00:00
|
|
|
|
(unless (child-of-class-p desired-class 'semanticdb-abstract-cache)
|
|
|
|
|
(error "Invalid SemanticDB cache"))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(let ((cache (oref db cache))
|
|
|
|
|
(obj nil))
|
|
|
|
|
(while (and (not obj) cache)
|
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
|
|
|
|
(if (eq (eieio--object-class (car cache)) desired-class)
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(setq obj (car cache)))
|
|
|
|
|
(setq cache (cdr cache)))
|
|
|
|
|
(if obj
|
|
|
|
|
obj ;; Just return it.
|
2011-11-15 18:37:37 +01:00
|
|
|
|
;; No object, let's create a new one and return that.
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(setq obj (funcall desired-class "Cache" :db db))
|
|
|
|
|
(object-add-to-list db 'cache obj)
|
|
|
|
|
obj)))
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-cache-remove ((db semanticdb-project-database)
|
|
|
|
|
cache)
|
|
|
|
|
"Remove from TABLE the cache object CACHE."
|
|
|
|
|
(object-remove-from-list db 'cache cache))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-synchronize ((cache semanticdb-abstract-db-cache)
|
|
|
|
|
new-tags)
|
|
|
|
|
"Synchronize a CACHE with some NEW-TAGS."
|
|
|
|
|
;; The abstract class will do... NOTHING!
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-partial-synchronize ((cache semanticdb-abstract-db-cache)
|
|
|
|
|
new-tags)
|
|
|
|
|
"Synchronize a CACHE with some changed NEW-TAGS."
|
|
|
|
|
;; The abstract class will do... NOTHING!
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;;; REFRESH
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-refresh-table ((obj semanticdb-table) &optional force)
|
|
|
|
|
"If the tag list associated with OBJ is loaded, refresh it.
|
|
|
|
|
Optional argument FORCE will force a refresh even if the file in question
|
|
|
|
|
is not in a buffer. Avoid using FORCE for most uses, as an old cache
|
|
|
|
|
may be sufficient for the general case. Forced updates can be slow.
|
|
|
|
|
This will call `semantic-fetch-tags' if that file is in memory."
|
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
|
|
|
|
(cond
|
|
|
|
|
;;
|
|
|
|
|
;; Already in a buffer, just do it.
|
|
|
|
|
((semanticdb-in-buffer-p obj)
|
|
|
|
|
(semanticdb-set-buffer obj)
|
|
|
|
|
(semantic-fetch-tags))
|
|
|
|
|
;;
|
|
|
|
|
;; Not in a buffer. Forcing a load.
|
|
|
|
|
(force
|
|
|
|
|
;; Patch from Iain Nicol. --
|
|
|
|
|
;; @TODO: I wonder if there is a way to recycle
|
|
|
|
|
;; semanticdb-create-table-for-file-not-in-buffer
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(save-excursion
|
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
|
|
|
|
(let ((buff (semantic-find-file-noselect
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(semanticdb-full-filename obj) t)))
|
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
|
|
|
|
(set-buffer buff)
|
|
|
|
|
(semantic-fetch-tags)
|
|
|
|
|
;; Kill off the buffer if it didn't exist when we were called.
|
|
|
|
|
(kill-buffer buff))))))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-needs-refresh-p ((obj semanticdb-table))
|
|
|
|
|
"Return non-nil of OBJ's tag list is out of date.
|
|
|
|
|
The file associated with OBJ does not need to be in a buffer."
|
|
|
|
|
(let* ((ff (semanticdb-full-filename obj))
|
|
|
|
|
(buff (semanticdb-in-buffer-p obj))
|
|
|
|
|
)
|
|
|
|
|
(if buff
|
* 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 buff
|
2009-08-28 15:19:20 +00:00
|
|
|
|
;; Use semantic's magic tracker to determine of the buffer is up
|
|
|
|
|
;; to date or not.
|
|
|
|
|
(not (semantic-parse-tree-up-to-date-p))
|
|
|
|
|
;; We assume that semanticdb is keeping itself up to date.
|
|
|
|
|
;; via all the clever hooks
|
|
|
|
|
)
|
|
|
|
|
;; Buffer isn't loaded. The only clue we have is if the file
|
|
|
|
|
;; is somehow different from our mark in the semanticdb table.
|
|
|
|
|
(let* ((stats (file-attributes ff))
|
|
|
|
|
(actualsize (nth 7 stats))
|
|
|
|
|
(actualmod (nth 5 stats))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(or (not (slot-boundp obj 'tags))
|
|
|
|
|
;; (not (oref obj tags)) --> not needed anymore?
|
|
|
|
|
(/= (or (oref obj fsize) 0) actualsize)
|
|
|
|
|
(not (equal (oref obj lastmodtime) actualmod))
|
|
|
|
|
)
|
|
|
|
|
))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Synchronization
|
|
|
|
|
;;
|
|
|
|
|
(defmethod semanticdb-synchronize ((table semanticdb-abstract-table)
|
|
|
|
|
new-tags)
|
|
|
|
|
"Synchronize the table TABLE with some NEW-TAGS."
|
|
|
|
|
(oset table tags new-tags)
|
|
|
|
|
(oset table pointmax (point-max))
|
|
|
|
|
(let ((fattr (file-attributes (semanticdb-full-filename table))))
|
|
|
|
|
(oset table fsize (nth 7 fattr))
|
|
|
|
|
(oset table lastmodtime (nth 5 fattr))
|
|
|
|
|
)
|
|
|
|
|
;; Assume it is now up to date.
|
|
|
|
|
(oset table unmatched-syntax semantic-unmatched-syntax-cache)
|
|
|
|
|
;; The lexical table should be good too.
|
2009-09-06 21:22:05 +00:00
|
|
|
|
(when (featurep 'semantic/lex-spp)
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(oset table lexical-table (semantic-lex-spp-save-table)))
|
2011-11-17 01:09:20 -08:00
|
|
|
|
;; this implies dirtiness
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(semanticdb-set-dirty table)
|
|
|
|
|
|
|
|
|
|
;; Synchronize the index
|
|
|
|
|
(when (slot-boundp table 'index)
|
|
|
|
|
(let ((idx (oref table index)))
|
|
|
|
|
(when idx (semanticdb-synchronize idx new-tags))))
|
|
|
|
|
|
|
|
|
|
;; Synchronize application caches.
|
|
|
|
|
(dolist (C (oref table cache))
|
|
|
|
|
(semanticdb-synchronize C new-tags)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Update cross references
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(semanticdb-refresh-references table)
|
2009-08-28 15:19:20 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-partial-synchronize ((table semanticdb-abstract-table)
|
|
|
|
|
new-tags)
|
|
|
|
|
"Synchronize the table TABLE where some NEW-TAGS changed."
|
|
|
|
|
;; You might think we need to reset the tags, but since the partial
|
|
|
|
|
;; parser splices the lists, we don't need to do anything
|
|
|
|
|
;;(oset table tags new-tags)
|
|
|
|
|
;; We do need to mark ourselves dirty.
|
|
|
|
|
(semanticdb-set-dirty table)
|
|
|
|
|
|
|
|
|
|
;; The lexical table may be modified.
|
2009-09-06 21:22:05 +00:00
|
|
|
|
(when (featurep 'semantic/lex-spp)
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(oset table lexical-table (semantic-lex-spp-save-table)))
|
|
|
|
|
|
2011-11-19 18:29:42 -08:00
|
|
|
|
;; Incremental parser doesn't monkey around with this.
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(oset table unmatched-syntax semantic-unmatched-syntax-cache)
|
|
|
|
|
|
|
|
|
|
;; Synchronize the index
|
|
|
|
|
(when (slot-boundp table 'index)
|
|
|
|
|
(let ((idx (oref table index)))
|
|
|
|
|
(when idx (semanticdb-partial-synchronize idx new-tags))))
|
|
|
|
|
|
|
|
|
|
;; Synchronize application caches.
|
|
|
|
|
(dolist (C (oref table cache))
|
|
|
|
|
(semanticdb-synchronize C new-tags)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Update cross references
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(when (semantic-find-tags-by-class 'include new-tags)
|
|
|
|
|
(semanticdb-refresh-references table))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;;; SAVE/LOAD
|
|
|
|
|
;;
|
|
|
|
|
(defmethod semanticdb-save-db ((DB semanticdb-project-database)
|
2011-12-14 13:05:20 -08:00
|
|
|
|
&optional suppress-questions)
|
2009-08-28 15:19:20 +00:00
|
|
|
|
"Cause a database to save itself.
|
|
|
|
|
The database base class does not save itself persistently.
|
|
|
|
|
Subclasses could save themselves to a file, or to a database, or other
|
|
|
|
|
form."
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defun semanticdb-save-current-db ()
|
|
|
|
|
"Save the current tag database."
|
|
|
|
|
(interactive)
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(unless noninteractive
|
|
|
|
|
(message "Saving current tag summaries..."))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(semanticdb-save-db semanticdb-current-database)
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(unless noninteractive
|
|
|
|
|
(message "Saving current tag summaries...done")))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
2009-09-21 18:20:50 +00:00
|
|
|
|
;; This prevents Semanticdb from querying multiple times if the users
|
|
|
|
|
;; answers "no" to creating the Semanticdb directory.
|
|
|
|
|
(defvar semanticdb--inhibit-create-file-directory)
|
|
|
|
|
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(defun semanticdb-save-all-db ()
|
|
|
|
|
"Save all semantic tag databases."
|
|
|
|
|
(interactive)
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(unless noninteractive
|
|
|
|
|
(message "Saving tag summaries..."))
|
Stop keeping (all but one) generated cedet grammar files in the repository
* configure.ac (SUBDIR_MAKEFILES, AC_CONFIG_FILES):
Add admin/grammars Makefile.
* Makefile.in (distclean, bootstrap-clean, maintainer-clean):
Also clean admin/grammars, if present.
* admin/grammars/README: Remove.
* admin/grammars/Makefile.in: New file.
* admin/grammars/c.by, admin/grammars/java-tags.wy, admin/grammars/js.wy:
* admin/grammars/python.wy: Update declarations to match generated outputs.
* lisp/Makefile.in (semantic): New.
(compile-main): Depend on semantic.
* lisp/cedet/semantic/bovine/grammar.el (bovine--make-parser-1):
New function, split from bovine-make-parsers.
(bovine-make-parsers): Use bovine--make-parser-1.
(bovine-batch-make-parser): New function.
* lisp/cedet/semantic/wisent/grammar.el (wisent--make-parser-1):
New function, split from wisent-make-parsers.
(wisent-make-parsers): Use wisent--make-parser-1.
(wisent-batch-make-parser): New function.
* lisp/cedet/semantic/db.el (semanticdb-save-all-db):
Avoid prompting in batch mode.
* lisp/cedet/semantic/grammar.el (semantic-grammar-footer-template):
Disable version-control and autoloads in the output.
(semantic-grammar-create-package):
Add option to return nil if output is up-to-date.
* lisp/cedet/semantic/bovine/c-by.el, lisp/cedet/semantic/bovine/make-by.el:
* lisp/cedet/semantic/bovine/scm-by.el, lisp/cedet/semantic/wisent/javat-wy.el:
* lisp/cedet/semantic/wisent/js-wy.el, lisp/cedet/semantic/wisent/python-wy.el:
* lisp/cedet/srecode/srt-wy.el: Remove generated files from repository.
* .bzrignore: Update for this.
2013-11-29 18:06:34 -08:00
|
|
|
|
(let ((semanticdb--inhibit-make-directory noninteractive))
|
2009-09-21 18:20:50 +00:00
|
|
|
|
(mapc 'semanticdb-save-db semanticdb-database-list))
|
2012-10-02 02:10:29 +08:00
|
|
|
|
(unless noninteractive
|
|
|
|
|
(message "Saving tag summaries...done")))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
|
|
|
|
(defun semanticdb-save-all-db-idle ()
|
|
|
|
|
"Save all semantic tag databases from idle time.
|
|
|
|
|
Exit the save between databases if there is user input."
|
|
|
|
|
(semantic-safe "Auto-DB Save: %S"
|
|
|
|
|
(semantic-exit-on-input 'semanticdb-idle-save
|
|
|
|
|
(mapc (lambda (db)
|
|
|
|
|
(semantic-throw-on-input 'semanticdb-idle-save)
|
|
|
|
|
(semanticdb-save-db db t))
|
|
|
|
|
semanticdb-database-list))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
;;; Directory Project support
|
|
|
|
|
;;
|
|
|
|
|
(defvar semanticdb-project-predicate-functions nil
|
|
|
|
|
"List of predicates to try that indicate a directory belongs to a project.
|
|
|
|
|
This list is used when `semanticdb-persistent-path' contains the value
|
|
|
|
|
'project. If the predicate list is nil, then presume all paths are valid.
|
|
|
|
|
|
|
|
|
|
Project Management software (such as EDE and JDE) should add their own
|
|
|
|
|
predicates with `add-hook' to this variable, and semanticdb will save tag
|
|
|
|
|
caches in directories controlled by them.")
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-write-directory-p ((obj semanticdb-project-database))
|
|
|
|
|
"Return non-nil if OBJ should be written to disk.
|
|
|
|
|
Uses `semanticdb-persistent-path' to determine the return value."
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
;;; Utilities
|
|
|
|
|
;;
|
|
|
|
|
;; What is the current database, are two tables of an equivalent mode,
|
|
|
|
|
;; and what databases are a part of the same project.
|
|
|
|
|
(defun semanticdb-current-database ()
|
|
|
|
|
"Return the currently active database."
|
|
|
|
|
(or semanticdb-current-database
|
|
|
|
|
(and default-directory
|
|
|
|
|
(semanticdb-create-database semanticdb-new-database-class
|
|
|
|
|
default-directory)
|
|
|
|
|
)
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
(defvar semanticdb-match-any-mode nil
|
2009-10-01 04:54:05 +00:00
|
|
|
|
"Non-nil to temporarily search any major mode for a tag.
|
2009-08-28 15:19:20 +00:00
|
|
|
|
If a particular major mode wants to search any mode, put the
|
|
|
|
|
`semantic-match-any-mode' symbol onto the symbol of that major mode.
|
|
|
|
|
Do not set the value of this variable permanently.")
|
|
|
|
|
|
|
|
|
|
(defmacro semanticdb-with-match-any-mode (&rest body)
|
2009-10-01 04:54:05 +00:00
|
|
|
|
"A Semanticdb search occurring withing BODY will search tags in all modes.
|
|
|
|
|
This temporarily sets `semanticdb-match-any-mode' while executing BODY."
|
2009-08-28 15:19:20 +00:00
|
|
|
|
`(let ((semanticdb-match-any-mode t))
|
|
|
|
|
,@body))
|
|
|
|
|
(put 'semanticdb-with-match-any-mode 'lisp-indent-function 0)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-equivalent-mode-for-search (table &optional buffer)
|
|
|
|
|
"Return non-nil if TABLE's mode is equivalent to BUFFER.
|
|
|
|
|
See `semanticdb-equivalent-mode' for details.
|
|
|
|
|
This version is used during searches. Major-modes that opt
|
|
|
|
|
to set the `semantic-match-any-mode' property will be able to search
|
|
|
|
|
all files of any type."
|
|
|
|
|
(or (get major-mode 'semantic-match-any-mode)
|
|
|
|
|
semanticdb-match-any-mode
|
|
|
|
|
(semanticdb-equivalent-mode table buffer))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-equivalent-mode ((table semanticdb-abstract-table) &optional buffer)
|
|
|
|
|
"Return non-nil if TABLE's mode is equivalent to BUFFER.
|
2010-01-15 18:51:50 -08:00
|
|
|
|
Equivalent modes are specified by the `semantic-equivalent-major-modes'
|
2009-08-28 15:19:20 +00:00
|
|
|
|
local variable."
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defmethod semanticdb-equivalent-mode ((table semanticdb-table) &optional buffer)
|
|
|
|
|
"Return non-nil if TABLE's mode is equivalent to BUFFER.
|
2010-01-15 18:51:50 -08:00
|
|
|
|
Equivalent modes are specified by the `semantic-equivalent-major-modes'
|
2009-08-28 15:19:20 +00:00
|
|
|
|
local variable."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(if buffer (set-buffer buffer))
|
|
|
|
|
(or
|
|
|
|
|
;; nil major mode in table means we don't know yet. Assume yes for now?
|
|
|
|
|
(null (oref table major-mode))
|
|
|
|
|
;; nil means the same as major-mode
|
|
|
|
|
(and (not semantic-equivalent-major-modes)
|
|
|
|
|
(mode-local-use-bindings-p major-mode (oref table major-mode)))
|
|
|
|
|
(and semantic-equivalent-major-modes
|
|
|
|
|
(member (oref table major-mode) semantic-equivalent-major-modes))
|
|
|
|
|
)
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Associations
|
|
|
|
|
;;
|
|
|
|
|
;; These routines determine associations between a file, and multiple
|
|
|
|
|
;; associated databases.
|
|
|
|
|
|
|
|
|
|
(defcustom semanticdb-project-roots nil
|
|
|
|
|
"*List of directories, where each directory is the root of some project.
|
|
|
|
|
All subdirectories of a root project are considered a part of one project.
|
2009-10-01 04:54:05 +00:00
|
|
|
|
Values in this string can be overridden by project management programs
|
2009-08-28 15:19:20 +00:00
|
|
|
|
via the `semanticdb-project-root-functions' variable."
|
|
|
|
|
:group 'semanticdb
|
|
|
|
|
:type '(repeat string))
|
|
|
|
|
|
|
|
|
|
(defvar semanticdb-project-root-functions nil
|
|
|
|
|
"List of functions used to determine a given directories project root.
|
|
|
|
|
Functions in this variable can override `semanticdb-project-roots'.
|
|
|
|
|
Functions set in the variable are given one argument (a directory) and
|
|
|
|
|
must return a string, (the root directory) or a list of strings (multiple
|
|
|
|
|
root directories in a more complex system). This variable should be used
|
|
|
|
|
by project management programs like EDE or JDE.")
|
|
|
|
|
|
|
|
|
|
(defvar semanticdb-project-system-databases nil
|
|
|
|
|
"List of databases containing system library information.
|
|
|
|
|
Mode authors can create their own system databases which know
|
|
|
|
|
detailed information about the system libraries for querying purposes.
|
|
|
|
|
Put those into this variable as a buffer-local, or mode-local
|
|
|
|
|
value.")
|
|
|
|
|
(make-variable-buffer-local 'semanticdb-project-system-databases)
|
|
|
|
|
|
|
|
|
|
(defvar semanticdb-search-system-databases t
|
|
|
|
|
"Non nil if search routines are to include a system database.")
|
|
|
|
|
|
|
|
|
|
(defun semanticdb-current-database-list (&optional dir)
|
|
|
|
|
"Return a list of databases associated with the current buffer.
|
|
|
|
|
If optional argument DIR is non-nil, then use DIR as the starting directory.
|
|
|
|
|
If this buffer has a database, but doesn't have a project associated
|
|
|
|
|
with it, return nil.
|
|
|
|
|
First, it checks `semanticdb-project-root-functions', and if that
|
|
|
|
|
has no results, it checks `semanticdb-project-roots'. If that fails,
|
|
|
|
|
it returns the results of function `semanticdb-current-database'.
|
|
|
|
|
Always append `semanticdb-project-system-databases' if
|
|
|
|
|
`semanticdb-search-system' is non-nil."
|
|
|
|
|
(let ((root nil) ; found root directory
|
|
|
|
|
(dbs nil) ; collected databases
|
|
|
|
|
(roots semanticdb-project-roots) ;all user roots
|
|
|
|
|
(dir (file-truename (or dir default-directory)))
|
|
|
|
|
)
|
|
|
|
|
;; Find the root based on project functions.
|
|
|
|
|
(setq root (run-hook-with-args-until-success
|
|
|
|
|
'semanticdb-project-root-functions
|
|
|
|
|
dir))
|
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
|
|
|
|
(if root
|
|
|
|
|
(setq root (file-truename root))
|
|
|
|
|
;; Else, Find roots based on strings
|
|
|
|
|
(while roots
|
|
|
|
|
(let ((r (file-truename (car roots))))
|
|
|
|
|
(if (string-match (concat "^" (regexp-quote r)) dir)
|
|
|
|
|
(setq root r)))
|
|
|
|
|
(setq roots (cdr roots))))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
|
|
|
|
|
;; If no roots are found, use this directory.
|
|
|
|
|
(unless root (setq root dir))
|
|
|
|
|
|
|
|
|
|
;; Find databases based on the root directory.
|
|
|
|
|
(when root
|
|
|
|
|
;; The rootlist allows the root functions to possibly
|
|
|
|
|
;; return several roots which are in different areas but
|
|
|
|
|
;; all apart of the same system.
|
|
|
|
|
(let ((regexp (concat "^" (regexp-quote root)))
|
|
|
|
|
(adb semanticdb-database-list) ; all databases
|
|
|
|
|
)
|
|
|
|
|
(while adb
|
|
|
|
|
;; I don't like this part, but close enough.
|
|
|
|
|
(if (and (slot-boundp (car adb) 'reference-directory)
|
|
|
|
|
(string-match regexp (oref (car adb) reference-directory)))
|
|
|
|
|
(setq dbs (cons (car adb) dbs)))
|
|
|
|
|
(setq adb (cdr adb))))
|
|
|
|
|
)
|
|
|
|
|
;; Add in system databases
|
|
|
|
|
(when semanticdb-search-system-databases
|
|
|
|
|
(setq dbs (nconc dbs semanticdb-project-system-databases)))
|
|
|
|
|
;; Return
|
|
|
|
|
dbs))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Generic Accessor Routines
|
|
|
|
|
;;
|
|
|
|
|
;; These routines can be used to get at tags in files w/out
|
|
|
|
|
;; having to know a lot about semanticDB.
|
|
|
|
|
(defvar semanticdb-file-table-hash (make-hash-table :test 'equal)
|
|
|
|
|
"Hash table mapping file names to database tables.")
|
|
|
|
|
|
|
|
|
|
(defun semanticdb-file-table-object-from-hash (file)
|
|
|
|
|
"Retrieve a DB table from the hash for FILE.
|
|
|
|
|
Does not use `file-truename'."
|
|
|
|
|
(gethash file semanticdb-file-table-hash 'no-hit))
|
|
|
|
|
|
|
|
|
|
(defun semanticdb-file-table-object-put-hash (file dbtable)
|
|
|
|
|
"For FILE, associate DBTABLE in the hash table."
|
|
|
|
|
(puthash file dbtable semanticdb-file-table-hash))
|
|
|
|
|
|
2009-09-02 04:37:10 +00:00
|
|
|
|
;;;###autoload
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(defun semanticdb-file-table-object (file &optional dontload)
|
|
|
|
|
"Return a semanticdb table belonging to FILE, make it up to date.
|
|
|
|
|
If file has database tags available in the database, return it.
|
|
|
|
|
If file does not have tags available, and DONTLOAD is nil,
|
|
|
|
|
then load the tags for FILE, and create a new table object for it.
|
|
|
|
|
DONTLOAD does not affect the creation of new database objects."
|
|
|
|
|
;; (message "Object Translate: %s" file)
|
Merge from CEDET upstream (8564).
* lisp/emacs-lisp:
* emacs-lisp/eieio.el (eieio--defalias, eieio-hook)
(eieio-error-unsupported-class-tags, eieio-skip-typecheck)
(eieio-optimize-primary-methods-flag, eieio-initializing-object)
(eieio-unbound, eieio-default-superclass)
(eieio--define-field-accessors, method-static, method-before)
(method-primary, method-after, method-num-lists)
(method-generic-before, method-generic-primary)
(method-generic-after, method-num-slots)
(eieio-specialized-key-to-generic-key)
(eieio--check-type, class-v, class-p)
(eieio-class-name, define-obsolete-function-alias)
(eieio-class-parents-fast, eieio-class-children-fast)
(same-class-fast-p, class-constructor, generic-p)
(generic-primary-only-p, generic-primary-only-one-p)
(class-option-assoc, class-option, eieio-object-p)
(class-abstract-p, class-method-invocation-order)
(eieio-defclass-autoload-map, eieio-defclass-autoload)
(eieio-class-un-autoload, eieio-defclass)
(eieio-eval-default-p, eieio-perform-slot-validation-for-default)
(eieio-add-new-slot, eieio-copy-parents-into-subclass)
(eieio--defgeneric-init-form, eieio-defgeneric-form)
(eieio-defgeneric-reset-generic-form)
(eieio-defgeneric-form-primary-only)
(eieio-defgeneric-reset-generic-form-primary-only)
(eieio-defgeneric-form-primary-only-one)
(eieio-defgeneric-reset-generic-form-primary-only-one)
(eieio-unbind-method-implementations)
(eieio--defmethod, eieio--typep)
(eieio-perform-slot-validation, eieio-validate-slot-value)
(eieio-validate-class-slot-value, eieio-barf-if-slot-unbound)
(eieio-oref, eieio-oref-default, eieio-default-eval-maybe)
(eieio-oset, eieio-oset-default, eieio-slot-originating-class-p)
(eieio-slot-name-index, eieio-class-slot-name-index)
(eieio-set-defaults, eieio-initarg-to-attribute)
(eieio-attribute-to-initarg, eieio-c3-candidate)
(eieio-c3-merge-lists, eieio-class-precedence-c3)
(eieio-class-precedence-dfs, eieio-class-precedence-bfs)
(eieio-class-precedence-list, eieio-generic-call-methodname)
(eieio-generic-call-arglst, eieio-generic-call-key)
(eieio-generic-call-next-method-list)
(eieio-pre-method-execution-functions, eieio-generic-call)
(eieio-generic-call-primary-only, eieiomt-method-list)
(eieiomt-optimizing-obarray, eieiomt-install)
(eieiomt-add, eieiomt-next, eieiomt-sym-optimize)
(eieio-generic-form, eieio-defmethod, make-obsolete)
(eieio-defgeneric, make-obsolete): Moved to eieio-core.el
(defclass): Remove `eval-and-compile' from macro.
(call-next-method, shared-initialize): Instead of using
`scoped-class' variable, use new eieio--scoped-class, and
eieio--with-scoped-class.
(initialize-instance): Rename local variable 'scoped-class' to
'this-class' to remove ambiguitity from old global.
* emacs-lisp/eieio-core.el: New file. Derived from key parts of
eieio.el.
(eieio--scoped-class-stack): New variable
(eieio--scoped-class): New fcn
(eieio--with-scoped-class): New scoping macro.
(eieio-defclass): Use pushnew instead of add-to-list.
(eieio-defgeneric-form-primary-only-one, eieio-oset-default)
(eieio-slot-name-index, eieio-set-defaults, eieio-generic-call)
(eieio-generic-call-primary-only, eieiomt-add): Instead of using
`scoped-class' variable, use new eieio--scoped-class, and
eieio--with-scoped-class.
* emacs-lisp/eieio-base.el (cl-lib): Require during compile.
* admin/grammars:
* grammars/srecode-template.wy (variable): Accept a single number
as a variable value. Allows the 'priority' to be set to a number.
(wisent-srecode-template-lexer): Move number up so it can be
created.
* etc/srecode:
* srecode/c.srt (header_guard): Add :c parameter so it works
standalone
* lisp/cedet:
* semantic/edit.el (semantic-change-function): Use
`save-match-data' around running hooks.
* semantic/decorate/mode.el
(semantic-decorate-style-predicate-default)
(semantic-decorate-style-highlighter-default): New.
(semantic-decoration-mode): Do not require
`semantic/decorate/include' anymore.
(semantic-toggle-decoration-style): Error if an unknown decoration
style is toggled.
(define-semantic-decoration-style): Add new :load option. When
:load is specified, add autoload tokens for the definition
functions so that code is loaded when the mode is used.
(semantic-decoration-on-includes): New autoload definition for
highlighting includes.
* semantic/bovine/c.el (semantic-lex-c-ifdef): Allow some misc
characters to appear after the tested variable.
* semantic/ede-grammar.el (project-compile-target): Calculate full
src name via ede-expand-filename instead of the crutch of the
current buffer. Enables this target to compile in batch mode.
* semantic/idle.el
(semantic-idle-symbol-maybe-highlight): Wrap highlighting of
remote symbol with `save-excursion'.
(semantic-idle-scheduler-work-parse-neighboring-files): Instead of
using directory-files on each found mode pattern, collect all the
patterns for the current mode, and then for each file, see if it
matches any of them. If it does, parse the file. (Patch
inspiration from Tomasz Gajewski.)
* semantic/ctxt.el (semantic-ctxt-end-of-symbol): New.
(semantic-ctxt-current-symbol-default): New.
* semantic/bovine/el.el (semantic-default-elisp-setup): Add
autoload cookie. Explain existence.
(footer): Add local variable for loaddefs.
* semantic/db.el (semanticdb-file-table-object): Add new filter,
only checking for regular files too.
* semantic/wisent/python.el
(semantic-format-tag-abbreviate): New override. Cuts back on size
of code tags.
* srecode/compile.el (srecode-compile-templates): Fix warning
punctuation. Remove status messages to clean up testing output
* ede/base.el (ede-project-placeholder-cache-file): Update doc to
mention 'nil' value.
(ede-save-cache): Disable cache save if file is nil.
* ede.el (ede-initialize-state-current-buffer): Flush deleted
projects.
(global-ede-mode): Always append our find-file-hook to the end.
(ede-flush-deleted-projects): New command.
* ede/cpp-root.el (ede-preprocessor-map): Protect against init
problems.
* ede/proj.el (ede-proj-target): Added a new "custom" option for
custom symbols representing a compiler or linker instead of
restricting things to only the predefined compilers and linkers.
* semantic.el (semantic-mode-map): To avoid showing showing
Development menu twice, only disable menu item if menu-bar is
actually enabled, otherwise the popup 'global menu' might display
a disabled Development menu.
* semantic/complete.el
(semantic-displayor-show-request): Fix which slot in obj is set to
the max tags.
2013-06-02 15:33:09 +02:00
|
|
|
|
(when (and file (file-exists-p file) (file-regular-p file))
|
2009-08-28 15:19:20 +00:00
|
|
|
|
(let* ((default-directory (file-name-directory file))
|
|
|
|
|
(tab (semanticdb-file-table-object-from-hash file))
|
|
|
|
|
(fullfile nil))
|
|
|
|
|
|
|
|
|
|
;; If it is not in the cache, then extract the more traditional
|
|
|
|
|
;; way by getting the database, and finding a table in that database.
|
|
|
|
|
;; Once we have a table, add it to the hash.
|
|
|
|
|
(when (eq tab 'no-hit)
|
|
|
|
|
(setq fullfile (file-truename file))
|
|
|
|
|
(let ((db (or ;; This line will pick up system databases.
|
|
|
|
|
(semanticdb-directory-loaded-p default-directory)
|
|
|
|
|
;; this line will make a new one if needed.
|
|
|
|
|
(semanticdb-get-database default-directory))))
|
|
|
|
|
(setq tab (semanticdb-file-table db fullfile))
|
|
|
|
|
(when tab
|
|
|
|
|
(semanticdb-file-table-object-put-hash file tab)
|
|
|
|
|
(when (not (string= fullfile file))
|
|
|
|
|
(semanticdb-file-table-object-put-hash fullfile tab)
|
|
|
|
|
))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(cond
|
|
|
|
|
((and tab
|
|
|
|
|
;; Is this in a buffer?
|
|
|
|
|
;;(find-buffer-visiting (semanticdb-full-filename tab))
|
|
|
|
|
(semanticdb-in-buffer-p tab)
|
|
|
|
|
)
|
|
|
|
|
(save-excursion
|
|
|
|
|
;;(set-buffer (find-buffer-visiting (semanticdb-full-filename tab)))
|
|
|
|
|
(semanticdb-set-buffer tab)
|
|
|
|
|
(semantic-fetch-tags)
|
|
|
|
|
;; Return the table.
|
|
|
|
|
tab))
|
|
|
|
|
((and tab dontload)
|
|
|
|
|
;; If we have table, and we don't want to load it, just return it.
|
|
|
|
|
tab)
|
|
|
|
|
((and tab
|
|
|
|
|
;; Is table fully loaded, or just a proxy?
|
|
|
|
|
(number-or-marker-p (oref tab pointmax))
|
|
|
|
|
;; Is this table up to date with the file?
|
|
|
|
|
(not (semanticdb-needs-refresh-p tab)))
|
|
|
|
|
;; A-ok!
|
|
|
|
|
tab)
|
|
|
|
|
((or (and fullfile (get-file-buffer fullfile))
|
|
|
|
|
(get-file-buffer file))
|
|
|
|
|
;; are these two calls this faster than `find-buffer-visiting'?
|
|
|
|
|
|
|
|
|
|
;; If FILE is being visited, but none of the above state is
|
|
|
|
|
;; true (meaning, there is no table object associated with it)
|
|
|
|
|
;; then it is a file not supported by Semantic, and can be safely
|
|
|
|
|
;; ignored.
|
|
|
|
|
nil)
|
|
|
|
|
((not dontload) ;; We must load the file.
|
|
|
|
|
;; Full file should have been set by now. Debug why not?
|
|
|
|
|
(when (and (not tab) (not fullfile))
|
|
|
|
|
;; This case is if a 'nil is erroneously put into the hash table. This
|
|
|
|
|
;; would need fixing
|
|
|
|
|
(setq fullfile (file-truename file))
|
|
|
|
|
)
|
|
|
|
|
|
2011-11-15 18:37:37 +01:00
|
|
|
|
;; If we have a table, but no fullfile, that's ok. Let's get the filename
|
2009-08-28 15:19:20 +00:00
|
|
|
|
;; from the table which is pre-truenamed.
|
|
|
|
|
(when (and (not fullfile) tab)
|
|
|
|
|
(setq fullfile (semanticdb-full-filename tab)))
|
|
|
|
|
|
|
|
|
|
(setq tab (semanticdb-create-table-for-file-not-in-buffer fullfile))
|
|
|
|
|
|
|
|
|
|
;; Save the new table.
|
|
|
|
|
(semanticdb-file-table-object-put-hash file tab)
|
|
|
|
|
(when (not (string= fullfile file))
|
|
|
|
|
(semanticdb-file-table-object-put-hash fullfile tab)
|
|
|
|
|
)
|
|
|
|
|
;; Done!
|
|
|
|
|
tab)
|
|
|
|
|
(t
|
|
|
|
|
;; Full file should have been set by now. Debug why not?
|
|
|
|
|
;; One person found this. Is it a file that failed to parse
|
|
|
|
|
;; in the past?
|
|
|
|
|
(when (not fullfile)
|
|
|
|
|
(setq fullfile (file-truename file)))
|
|
|
|
|
|
|
|
|
|
;; We were asked not to load the file in and parse it.
|
|
|
|
|
;; Instead just create a database table with no tags
|
|
|
|
|
;; and a claim of being empty.
|
|
|
|
|
;;
|
|
|
|
|
;; This will give us a starting point for storing
|
|
|
|
|
;; database cross-references so when it is loaded,
|
|
|
|
|
;; the cross-references will fire and caches will
|
|
|
|
|
;; be cleaned.
|
|
|
|
|
(let ((ans (semanticdb-create-table-for-file file)))
|
|
|
|
|
(setq tab (cdr ans))
|
|
|
|
|
|
|
|
|
|
;; Save the new table.
|
|
|
|
|
(semanticdb-file-table-object-put-hash file tab)
|
|
|
|
|
(when (not (string= fullfile file))
|
|
|
|
|
(semanticdb-file-table-object-put-hash fullfile tab)
|
|
|
|
|
)
|
|
|
|
|
;; Done!
|
|
|
|
|
tab))
|
|
|
|
|
)
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
(defvar semanticdb-out-of-buffer-create-table-fcn nil
|
|
|
|
|
"When non-nil, a function for creating a semanticdb table.
|
|
|
|
|
This should take a filename to be parsed.")
|
|
|
|
|
(make-variable-buffer-local 'semanticdb-out-of-buffer-create-table-fcn)
|
|
|
|
|
|
|
|
|
|
(defun semanticdb-create-table-for-file-not-in-buffer (filename)
|
|
|
|
|
"Create a table for the file FILENAME.
|
|
|
|
|
If there are no language specific configurations, this
|
|
|
|
|
function will read in the buffer, parse it, and kill the buffer."
|
|
|
|
|
(if (and semanticdb-out-of-buffer-create-table-fcn
|
|
|
|
|
(not (file-remote-p filename)))
|
|
|
|
|
;; Use external parser only of the file is accessible to the
|
|
|
|
|
;; local file system.
|
|
|
|
|
(funcall semanticdb-out-of-buffer-create-table-fcn filename)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(let* ( ;; Remember the buffer to kill
|
|
|
|
|
(kill-buffer-flag (find-buffer-visiting filename))
|
|
|
|
|
(buffer-to-kill (or kill-buffer-flag
|
|
|
|
|
(semantic-find-file-noselect filename t))))
|
|
|
|
|
|
|
|
|
|
;; This shouldn't ever be set. Debug some issue here?
|
|
|
|
|
;; (when kill-buffer-flag (debug))
|
|
|
|
|
|
|
|
|
|
(set-buffer buffer-to-kill)
|
|
|
|
|
;; Find file should automatically do this for us.
|
|
|
|
|
;; Sometimes the DB table doesn't contains tags and needs
|
|
|
|
|
;; a refresh. For example, when the file is loaded for
|
|
|
|
|
;; the first time, and the idle scheduler didn't get a
|
|
|
|
|
;; chance to trigger a parse before the file buffer is
|
|
|
|
|
;; killed.
|
|
|
|
|
(when semanticdb-current-table
|
|
|
|
|
(semantic-fetch-tags))
|
|
|
|
|
(prog1
|
|
|
|
|
semanticdb-current-table
|
|
|
|
|
(when (not kill-buffer-flag)
|
|
|
|
|
;; If we had to find the file, then we should kill it
|
|
|
|
|
;; to keep the master buffer list clean.
|
|
|
|
|
(kill-buffer buffer-to-kill)
|
|
|
|
|
)))))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun semanticdb-file-stream (file)
|
|
|
|
|
"Return a list of tags belonging to FILE.
|
|
|
|
|
If file has database tags available in the database, return them.
|
|
|
|
|
If file does not have tags available, then load the file, and create them."
|
|
|
|
|
(let ((table (semanticdb-file-table-object file)))
|
|
|
|
|
(when table
|
|
|
|
|
(semanticdb-get-tags table))))
|
|
|
|
|
|
|
|
|
|
(provide 'semantic/db)
|
|
|
|
|
|
2009-09-02 04:37:10 +00:00
|
|
|
|
;; Local variables:
|
|
|
|
|
;; generated-autoload-file: "loaddefs.el"
|
2009-09-05 01:00:36 +00:00
|
|
|
|
;; generated-autoload-load-name: "semantic/db"
|
2009-09-02 04:37:10 +00:00
|
|
|
|
;; 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.el ends here
|