1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-16 09:50:25 +00:00
emacs/lisp/cedet/semantic/fw.el

398 lines
15 KiB
EmacsLisp
Raw Normal View History

;;; semantic/fw.el --- Framework for Semantic
;;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; 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:
;;
;; Semantic has several core features shared across it's lex/parse/util
;; stages. This used to clutter semantic.el some. These routines are all
;; simple things that are not parser specific, but aid in making
;; semantic flexible and compatible amongst different Emacs platforms.
;;; Code:
;;
(require 'mode-local)
(require 'eieio)
* emacs-lisp/autoload.el (generated-autoload-feature): Remove. (autoload-rubric): Don't use any more. * cedet/semantic/fw.el (semantic/loaddefs): * cedet/srecode.el (srecode/loaddefs): * cedet/ede.el (ede/loaddefs): Load rather than require. * lisp/cedet/ede/cpp-root.el: * lisp/cedet/ede/emacs.el: * lisp/cedet/ede/files.el: * lisp/cedet/ede/linux.el: * lisp/cedet/ede/locate.el: * lisp/cedet/ede/make.el: * lisp/cedet/ede/shell.el: * lisp/cedet/ede/speedbar.el: * lisp/cedet/ede/system.el: * lisp/cedet/ede/util.el: * lisp/cedet/semantic/analyze.el: * lisp/cedet/semantic/bovine.el: * lisp/cedet/semantic/complete.el: * lisp/cedet/semantic/ctxt.el: * lisp/cedet/semantic/db-file.el: * lisp/cedet/semantic/db-find.el: * lisp/cedet/semantic/db-global.el: * lisp/cedet/semantic/db-mode.el: * lisp/cedet/semantic/db-typecache.el: * lisp/cedet/semantic/db.el: * lisp/cedet/semantic/debug.el: * lisp/cedet/semantic/dep.el: * lisp/cedet/semantic/doc.el: * lisp/cedet/semantic/edit.el: * lisp/cedet/semantic/find.el: * lisp/cedet/semantic/format.el: * lisp/cedet/semantic/html.el: * lisp/cedet/semantic/ia-sb.el: * lisp/cedet/semantic/ia.el: * lisp/cedet/semantic/idle.el: * lisp/cedet/semantic/lex-spp.el: * lisp/cedet/semantic/lex.el: * lisp/cedet/semantic/mru-bookmark.el: * lisp/cedet/semantic/scope.el: * lisp/cedet/semantic/senator.el: * lisp/cedet/semantic/sort.el: * lisp/cedet/semantic/symref.el: * lisp/cedet/semantic/tag-file.el: * lisp/cedet/semantic/tag-ls.el: * lisp/cedet/semantic/tag-write.el: * lisp/cedet/semantic/tag.el: * lisp/cedet/semantic/util-modes.el: * lisp/cedet/semantic/analyze/complete.el: * lisp/cedet/semantic/analyze/refs.el: * lisp/cedet/semantic/bovine/c.el: * lisp/cedet/semantic/bovine/gcc.el: * lisp/cedet/semantic/bovine/make.el: * lisp/cedet/semantic/bovine/scm.el: * lisp/cedet/semantic/decorate/include.el: * lisp/cedet/semantic/decorate/mode.el: * lisp/cedet/semantic/symref/cscope.el: * lisp/cedet/semantic/symref/global.el: * lisp/cedet/semantic/symref/grep.el: * lisp/cedet/semantic/symref/idutils.el: * lisp/cedet/semantic/symref/list.el: * lisp/cedet/semantic/wisent/java-tags.el: * lisp/cedet/semantic/wisent/javascript.el: * lisp/cedet/srecode/compile.el: * lisp/cedet/srecode/cpp.el: * lisp/cedet/srecode/document.el: * lisp/cedet/srecode/el.el: * lisp/cedet/srecode/expandproto.el: * lisp/cedet/srecode/getset.el: * lisp/cedet/srecode/insert.el: * lisp/cedet/srecode/java.el: * lisp/cedet/srecode/map.el: * lisp/cedet/srecode/mode.el: * lisp/cedet/srecode/template.el: * lisp/cedet/srecode/texi.el: Remove the file-local setting of generated-autoload-feature.
2009-11-03 21:45:31 +00:00
(load "semantic/loaddefs" nil 'nomessage)
;;; Compatibility
(defalias 'semantic-buffer-local-value 'buffer-local-value)
(defalias 'semantic-overlay-live-p 'overlay-buffer)
(defalias 'semantic-make-overlay 'make-overlay)
(defalias 'semantic-overlay-put 'overlay-put)
(defalias 'semantic-overlay-get 'overlay-get)
(defalias 'semantic-overlay-properties 'overlay-properties)
(defalias 'semantic-overlay-move 'move-overlay)
(defalias 'semantic-overlay-delete 'delete-overlay)
(defalias 'semantic-overlays-at 'overlays-at)
(defalias 'semantic-overlays-in 'overlays-in)
(defalias 'semantic-overlay-buffer 'overlay-buffer)
(defalias 'semantic-overlay-start 'overlay-start)
(defalias 'semantic-overlay-end 'overlay-end)
(defalias 'semantic-overlay-size 'overlay-size)
(defalias 'semantic-overlay-next-change 'next-overlay-change)
(defalias 'semantic-overlay-previous-change 'previous-overlay-change)
(defalias 'semantic-overlay-lists 'overlay-lists)
(defalias 'semantic-overlay-p 'overlayp)
(defalias 'semantic-read-event 'read-event)
(defalias 'semantic-popup-menu 'popup-menu)
(defalias 'semantic-make-local-hook 'identity)
(defalias 'semantic-mode-line-update 'force-mode-line-update)
(defalias 'semantic-run-mode-hooks 'run-mode-hooks)
(defalias 'semantic-compile-warn 'byte-compile-warn)
(defalias 'semantic-menu-item 'identity)
(defun semantic-event-window (event)
"Extract the window from EVENT."
(car (car (cdr event))))
(defun semantic-delete-overlay-maybe (overlay)
"Delete OVERLAY if it is a semantic token overlay."
(if (semantic-overlay-get overlay 'semantic)
(semantic-overlay-delete overlay)))
;;; Positional Data Cache
;;
(defvar semantic-cache-data-overlays nil
"List of all overlays waiting to be flushed.")
(defun semantic-cache-data-to-buffer (buffer start end value name &optional lifespan)
"In BUFFER over the region START END, remember VALUE.
NAME specifies a special name that can be searched for later to
recover the cached data with `semantic-get-cache-data'.
LIFESPAN indicates how long the data cache will be remembered.
The default LIFESPAN is 'end-of-command.
Possible Lifespans are:
'end-of-command - Remove the cache at the end of the currently
executing command.
'exit-cache-zone - Remove when point leaves the overlay at the
end of the currently executing command."
;; Check if LIFESPAN is valid before to create any overlay
(or lifespan (setq lifespan 'end-of-command))
(or (memq lifespan '(end-of-command exit-cache-zone))
(error "semantic-cache-data-to-buffer: Unknown LIFESPAN: %s"
lifespan))
(let ((o (semantic-make-overlay start end buffer)))
(semantic-overlay-put o 'cache-name name)
(semantic-overlay-put o 'cached-value value)
(semantic-overlay-put o 'lifespan lifespan)
(setq semantic-cache-data-overlays
(cons o semantic-cache-data-overlays))
;;(message "Adding to cache: %s" o)
(add-hook 'post-command-hook 'semantic-cache-data-post-command-hook)
))
(defun semantic-cache-data-post-command-hook ()
"Flush `semantic-cache-data-overlays' based 'lifespan property.
Remove self from `post-command-hook' if it is empty."
(let ((newcache nil)
(oldcache semantic-cache-data-overlays))
(while oldcache
(let* ((o (car oldcache))
(life (semantic-overlay-get o 'lifespan))
)
(if (or (eq life 'end-of-command)
(and (eq life 'exit-cache-zone)
(not (member o (semantic-overlays-at (point))))))
(progn
;;(message "Removing from cache: %s" o)
(semantic-overlay-delete o)
)
(setq newcache (cons o newcache))))
(setq oldcache (cdr oldcache)))
(setq semantic-cache-data-overlays (nreverse newcache)))
;; Remove ourselves if we have removed all overlays.
(unless semantic-cache-data-overlays
(remove-hook 'post-command-hook
'semantic-cache-data-post-command-hook)))
(defun semantic-get-cache-data (name &optional point)
"Get cached data with NAME from optional POINT."
(save-excursion
(if point (goto-char point))
(let ((o (semantic-overlays-at (point)))
(ans nil))
(while (and (not ans) o)
(if (equal (semantic-overlay-get (car o) 'cache-name) name)
(setq ans (car o))
(setq o (cdr o))))
(when ans
(semantic-overlay-get ans 'cached-value)))))
;;; Obsoleting various functions & variables
;;
(defun semantic-overload-symbol-from-function (name)
"Return the symbol for overload used by NAME, the defined symbol."
(let ((sym-name (symbol-name name)))
(if (string-match "^semantic-" sym-name)
(intern (substring sym-name (match-end 0)))
name)))
(defun semantic-alias-obsolete (oldfnalias newfn when)
"Make OLDFNALIAS an alias for NEWFN.
Mark OLDFNALIAS as obsolete, such that the byte compiler
will throw a warning when it encounters this symbol."
(defalias oldfnalias newfn)
(make-obsolete oldfnalias newfn when)
(when (and (function-overload-p newfn)
(not (overload-obsoleted-by newfn))
;; Only throw this warning when byte compiling things.
(boundp 'byte-compile-current-file)
byte-compile-current-file
(not (string-match "cedet" byte-compile-current-file))
)
(make-obsolete-overload oldfnalias newfn when)
(semantic-compile-warn
"%s: `%s' obsoletes overload `%s'"
byte-compile-current-file
newfn
(semantic-overload-symbol-from-function oldfnalias))
))
(defun semantic-varalias-obsolete (oldvaralias newvar when)
"Make OLDVARALIAS an alias for variable NEWVAR.
Mark OLDVARALIAS as obsolete, such that the byte compiler
will throw a warning when it encounters this symbol."
(make-obsolete-variable oldvaralias newvar when)
(condition-case nil
(defvaralias oldvaralias newvar)
(error
;; Only throw this warning when byte compiling things.
(when (and (boundp 'byte-compile-current-file)
byte-compile-current-file)
(semantic-compile-warn
"variable `%s' obsoletes, but isn't alias of `%s'"
newvar oldvaralias)
))))
;;; Help debugging
;;
(defmacro semantic-safe (format &rest body)
"Turn into a FORMAT message any error caught during eval of BODY.
Return the value of last BODY form or nil if an error occurred.
FORMAT can have a %s escape which will be replaced with the actual
error message.
If `debug-on-error' is set, errors are not caught, so that you can
debug them.
Avoid using a large BODY since it is duplicated."
;;(declare (debug t) (indent 1))
`(if debug-on-error
;;(let ((inhibit-quit nil)) ,@body)
;; Note to self: Doing the above screws up the wisent parser.
(progn ,@body)
(condition-case err
(progn ,@body)
(error
(message ,format (format "%S - %s" (current-buffer)
(error-message-string err)))
nil))))
(put 'semantic-safe 'lisp-indent-function 1)
;;; Misc utilities
;;
(defsubst semantic-map-buffers (function)
"Run FUNCTION for each Semantic enabled buffer found.
FUNCTION does not have arguments. When FUNCTION is entered
`current-buffer' is a selected Semantic enabled buffer."
(mode-local-map-file-buffers function #'semantic-active-p))
(defalias 'semantic-map-mode-buffers 'mode-local-map-mode-buffers)
(semantic-alias-obsolete 'define-mode-overload-implementation
'define-mode-local-override "23.2")
(defun semantic-install-function-overrides (overrides &optional transient mode)
"Install the function OVERRIDES in the specified environment.
OVERRIDES must be an alist ((OVERLOAD . FUNCTION) ...) where OVERLOAD
is a symbol identifying an overloadable entry, and FUNCTION is the
function to override it with.
If optional argument TRANSIENT is non-nil, installed overrides can in
turn be overridden by next installation.
If optional argument MODE is non-nil, it must be a major mode symbol.
OVERRIDES will be installed globally for this major mode. If MODE is
nil, OVERRIDES will be installed locally in the current buffer. This
later installation should be done in MODE hook."
(mode-local-bind
;; Add the semantic- prefix to OVERLOAD short names.
(mapcar
#'(lambda (e)
(let ((name (symbol-name (car e))))
(if (string-match "^semantic-" name)
e
(cons (intern (format "semantic-%s" name)) (cdr e)))))
overrides)
(list 'constant-flag (not transient)
'override-flag t)
mode))
;;; User Interrupt handling
;;
(defvar semantic-current-input-throw-symbol nil
"The current throw symbol for `semantic-exit-on-input'.")
(defmacro semantic-exit-on-input (symbol &rest forms)
"Using SYMBOL as an argument to `throw', execute FORMS.
If FORMS includes a call to `semantic-thow-on-input', then
if a user presses any key during execution, this form macro
will exit with the value passed to `semantic-throw-on-input'.
If FORMS completes, then the return value is the same as `progn'."
`(let ((semantic-current-input-throw-symbol ,symbol))
(catch ,symbol
,@forms)))
(put 'semantic-exit-on-input 'lisp-indent-function 1)
(defmacro semantic-throw-on-input (from)
"Exit with `throw' when in `semantic-exit-on-input' on user input.
FROM is an indication of where this function is called from as a value
to pass to `throw'. It is recommended to use the name of the function
calling this one."
`(when (and semantic-current-input-throw-symbol
(or (input-pending-p) (accept-process-output)))
(throw semantic-current-input-throw-symbol ,from)))
;;; Special versions of Find File
;;
(defun semantic-find-file-noselect (file &optional nowarn rawfile wildcards)
"Call `find-file-noselect' with various features turned off.
Use this when referencing a file that will be soon deleted.
FILE, NOWARN, RAWFILE, and WILDCARDS are passed into `find-file-noselect'"
(let* ((recentf-exclude '( (lambda (f) t) ))
;; This is a brave statement. Don't waste time loading in
;; lots of modes. Especially decoration mode can waste a lot
;; of time for a buffer we intend to kill.
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix. * cedet/semantic/idle.el (semantic-before-idle-scheduler-reparse-hook) (semantic-after-idle-scheduler-reparse-hook): Rename from *-hooks. Make old name an obsolete alias. * cedet/semantic/edit.el (semantic-after-partial-cache-change-hook) (semantic-change-hooks, semantic-edits-new-change-hooks) (semantic-edits-delete-change-hooks) (semantic-edits-move-change-hook) (semantic-edits-reparse-change-hooks) (semantic-edits-incremental-reparse-failed-hooks): Doc fixes. * cedet/semantic/debug.el (semantic-debug-mode): Rename hook symbols. * cedet/semantic/db-mode.el (semanticdb-mode-hook): Rename from semanticdb-mode-hooks. (global-semanticdb-minor-mode): Use the new name. (semanticdb-hooks): Use semantic-init-db-hook instead of obsolete alias semantic-init-db-hooks. * cedet/semantic/db-global.el (semanticdb-enable-gnu-global-databases): Use semantic-init-hook instead of obsolete alias semantic-init-hooks. * cedet/semantic/db-file.el (semanticdb-save-database-hook): Rename from semanticdb-save-database-hooks. Make old name an obsolete alias. * cedet/semantic/decorate/mode.el (semantic-decorate-pending-decoration-hook): Rename from semantic-decorate-pending-decoration-hooks. Make old name an obsolete alias. * cedet/srecode/map.el (srecode-map-validate-file-for-mode): Use semantic-init-hook instead of obsolete alias semantic-init-hooks. * cedet/semantic/fw.el (semantic-find-file-noselect): Use semantic-init-hook instead of obsolete alias semantic-init-hooks. * cedet/ede/project-am.el (project-am-with-makefile-current): Use semantic-init-hook instead of obsolete alias semantic-init-hooks. * cedet/semantic/util.el (semantic-describe-buffer): Use semantic-init-hook and semantic-init-db-hook instead of obsolete aliases. * cedet/semantic/util-modes.el (semantic-mode-line-update) (semantic-toggle-minor-mode-globally): Use semantic-init-hook instead of obsolete alias semantic-init-hooks. Synch to Eric M. Ludlam's upstream CEDET repository: * cedet/semantic/bovine/c.el (semantic-c-parse-token-hack-depth): New var. (semantic-c-parse-lexical-token): Save match data when setting up the secondary parse buffer. Allow recursion. Protect against initializing the major mode from throwing errors, ie user hooks. * cedet/semantic/lex-spp.el (semantic-lex-spp-lex-text-string): Protect installing a major mode from throwing errors.
2009-09-26 17:47:11 +00:00
(semantic-init-hook nil)
;; This disables the part of EDE that asks questions
(ede-auto-add-method 'never)
;; Ask font-lock to not colorize these buffers, nor to
;; whine about it either.
(font-lock-maximum-size 0)
(font-lock-verbose nil)
;; Disable revision control
(vc-handled-backends nil)
;; Don't prompt to insert a template if we visit an empty file
(auto-insert nil)
;; We don't want emacs to query about unsafe local variables
(enable-local-variables
(if (featurep 'xemacs)
;; XEmacs only has nil as an option?
nil
;; Emacs 23 has the spiffy :safe option, nil otherwise.
(if (>= emacs-major-version 22)
nil
:safe)))
;; ... or eval variables
(enable-local-eval nil)
)
(save-match-data
(if (featurep 'xemacs)
(find-file-noselect file nowarn rawfile)
(find-file-noselect file nowarn rawfile wildcards)))
))
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-19 02:49:54 +00:00
;;; Database restriction settings
;;
(defmacro semanticdb-without-unloaded-file-searches (forms)
"Execute FORMS with `unloaded' removed from the current throttle."
`(let ((semanticdb-find-default-throttle
(if (featurep 'semantic/db-find)
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-19 02:49:54 +00:00
(remq 'unloaded semanticdb-find-default-throttle)
nil)))
,forms))
(put 'semanticdb-without-unloaded-file-searches 'lisp-indent-function 1)
;; ;;; Editor goodies ;-)
;; ;;
;; (defconst semantic-fw-font-lock-keywords
;; (eval-when-compile
;; (let* (
;; ;; Variable declarations
;; (vl nil)
;; (kv (if vl (regexp-opt vl t) ""))
;; ;; Function declarations
;; (vf '(
;; "define-lex"
;; "define-lex-analyzer"
;; "define-lex-block-analyzer"
;; "define-lex-regex-analyzer"
;; "define-lex-spp-macro-declaration-analyzer"
;; "define-lex-spp-macro-undeclaration-analyzer"
;; "define-lex-spp-include-analyzer"
;; "define-lex-simple-regex-analyzer"
;; "define-lex-keyword-type-analyzer"
;; "define-lex-sexp-type-analyzer"
;; "define-lex-regex-type-analyzer"
;; "define-lex-string-type-analyzer"
;; "define-lex-block-type-analyzer"
;; ;;"define-mode-overload-implementation"
;; ;;"define-semantic-child-mode"
;; "define-semantic-idle-service"
;; "define-semantic-decoration-style"
;; "define-wisent-lexer"
;; "semantic-alias-obsolete"
;; "semantic-varalias-obsolete"
;; "semantic-make-obsolete-overload"
;; "defcustom-mode-local-semantic-dependency-system-include-path"
;; ))
;; (kf (if vf (regexp-opt vf t) ""))
;; ;; Regexp depths
;; (kv-depth (if kv (regexp-opt-depth kv) nil))
;; (kf-depth (if kf (regexp-opt-depth kf) nil))
;; )
;; `((,(concat
;; ;; Declarative things
;; "(\\(" kv "\\|" kf "\\)"
;; ;; Whitespaces & names
;; "\\>[ \t]*\\(\\sw+\\)?[ \t]*\\(\\sw+\\)?"
;; )
;; (1 font-lock-keyword-face)
;; (,(+ 1 kv-depth kf-depth 1)
;; (cond ((match-beginning 2)
;; font-lock-type-face)
;; ((match-beginning ,(+ 1 kv-depth 1))
;; font-lock-function-name-face)
;; )
;; nil t)
;; (,(+ 1 kv-depth kf-depth 1 1)
;; (cond ((match-beginning 2)
;; font-lock-variable-name-face)
;; )
;; nil t)))
;; ))
;; "Highlighted Semantic keywords.")
;; (when (fboundp 'font-lock-add-keywords)
;; (font-lock-add-keywords 'emacs-lisp-mode
;; semantic-fw-font-lock-keywords))
;;; Interfacing with edebug
;;
(defun semantic-fw-add-edebug-spec ()
(def-edebug-spec semantic-exit-on-input 'def-body))
(add-hook 'edebug-setup-hook 'semantic-fw-add-edebug-spec)
(provide 'semantic/fw)
;;; semantic/fw.el ends here