1 ;;; semantic.el --- Semantic buffer evaluator.
3 ;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
6 ;; Keywords: syntax tools
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; API for providing the semantic content of a buffer.
28 ;; The Semantic API provides an interface to a series of different parser
29 ;; implementations. Each parser outputs a parse tree in a similar format
30 ;; designed to handle typical functional and object oriented languages.
32 ;; To enable Semantic, turn on `semantic-mode', a global minor mode
33 ;; (M-x semantic-mode RET, or "Source Code Parsers" from the Tools
34 ;; menu). To enable it at startup, put (semantic-mode 1) in your init
38 (require 'semantic
/tag
)
39 (require 'semantic
/lex
)
41 (defvar semantic-version
"2.2"
42 "Current version of Semantic.")
44 (declare-function inversion-test
"inversion")
45 (declare-function semanticdb-load-ebrowse-caches
"semantic/db-ebrowse")
47 (defun semantic-require-version (major minor
&optional beta
)
48 "Non-nil if this version of Semantic does not satisfy a specific version.
51 (MAJOR MINOR &optional BETA)
53 Values MAJOR and MINOR must be integers. BETA can be an integer, or
54 excluded if a released version is required.
56 It is assumed that if the current version is newer than that specified,
57 everything passes. Exceptions occur when known incompatibilities are
60 (inversion-test 'semantic
61 (concat major
"." minor
62 (when beta
(concat "beta" beta
)))))
64 (defgroup semantic nil
65 "Parser Generator and parser framework."
68 (defgroup semantic-faces nil
69 "Faces used for Semantic enabled tools."
72 (require 'semantic
/fw
)
77 ;;; Variables and Configuration
79 (defvar semantic--parse-table nil
80 "Variable that defines how to parse top level items in a buffer.
81 This variable is for internal use only, and its content depends on the
82 external parser used.")
83 (make-variable-buffer-local 'semantic--parse-table
)
84 (semantic-varalias-obsolete 'semantic-toplevel-bovine-table
85 'semantic--parse-table
"23.2")
87 (defvar semantic-symbol-
>name-assoc-list
89 (variable .
"Variables")
90 (function .
"Functions")
91 (include .
"Dependencies")
92 (package .
"Provides"))
93 "Association between symbols returned, and a string.
94 The string is used to represent a group of objects of the given type.
95 It is sometimes useful for a language to use a different string
96 in place of the default, even though that language will still
97 return a symbol. For example, Java return's includes, but the
98 string can be replaced with `Imports'.")
99 (make-variable-buffer-local 'semantic-symbol-
>name-assoc-list
)
101 (defvar semantic-symbol-
>name-assoc-list-for-type-parts nil
102 "Like `semantic-symbol->name-assoc-list' for type parts.
103 Some tags that have children (see `semantic-tag-children-compatibility')
104 will want to define the names of classes of tags differently than at
105 the top level. For example, in C++, a Function may be called a
106 Method. In addition, there may be new types of tags that exist only
107 in classes, such as protection labels.")
108 (make-variable-buffer-local 'semantic-symbol-
>name-assoc-list-for-type-parts
)
110 (defvar semantic-case-fold nil
111 "Value for `case-fold-search' when parsing.")
112 (make-variable-buffer-local 'semantic-case-fold
)
114 (defvar semantic-expand-nonterminal nil
115 "Function to call for each nonterminal production.
116 Return a list of non-terminals derived from the first argument, or nil
117 if it does not need to be expanded.
118 Languages with compound definitions should use this function to expand
119 from one compound symbol into several. For example, in C the definition
121 is easily parsed into one tag. This function should take this
122 compound tag and turn it into two tags, one for A, and the other for B.")
123 (make-variable-buffer-local 'semantic-expand-nonterminal
)
125 (defvar semantic--buffer-cache nil
126 "A cache of the fully parsed buffer.
127 If no significant changes have been made (based on the state) then
128 this is returned instead of re-parsing the buffer.
130 DO NOT USE THIS VARIABLE IN PROGRAMS.
132 If you need a tag list, use `semantic-fetch-tags'. If you need the
133 cached values for some reason, chances are you can add a hook to
134 `semantic-after-toplevel-cache-change-hook'.")
135 (make-variable-buffer-local 'semantic--buffer-cache
)
136 (semantic-varalias-obsolete 'semantic-toplevel-bovine-cache
137 'semantic--buffer-cache
"23.2")
139 (defvar semantic-unmatched-syntax-cache nil
140 "A cached copy of unmatched syntax tokens.")
141 (make-variable-buffer-local 'semantic-unmatched-syntax-cache
)
143 (defvar semantic-unmatched-syntax-cache-check nil
144 "Non-nil if the unmatched syntax cache is out of date.
145 This is tracked with `semantic-change-function'.")
146 (make-variable-buffer-local 'semantic-unmatched-syntax-cache-check
)
148 (defvar semantic-edits-are-safe nil
149 "When non-nil, modifications do not require a reparse.
150 This prevents tags from being marked dirty, and it prevents top level
151 edits from causing a cache check.
152 Use this when writing programs that could cause a full reparse, but
153 will not change the tag structure, such as adding or updating
154 `top-level' comments.")
156 (defvar semantic-unmatched-syntax-hook nil
157 "Hooks run when Semantic detects syntax not matched in a grammar.
158 Each individual piece of syntax (such as a symbol or punctuation
159 character) is called with this hook when it doesn't match in the
160 grammar, and multiple unmatched syntax elements are not grouped
161 together. Each hook is called with one argument, which is a list
162 of syntax tokens created by the semantic lexer. Use the functions
163 `semantic-lex-token-start', `semantic-lex-token-end' and
164 `semantic-lex-token-text' to get information about these tokens.
165 The current buffer is the buffer these tokens are derived from.")
167 (defvar semantic--before-fetch-tags-hook nil
168 "Hooks run before a buffer is parsed for tags.
169 It is called before any request for tags is made via the function
170 `semantic-fetch-tags' by an application.
171 If any hook returns a nil value, the cached value is returned
172 immediately, even if it is empty.")
173 (semantic-varalias-obsolete 'semantic-before-toplevel-bovination-hook
174 'semantic--before-fetch-tags-hook
"23.2")
176 (defvar semantic-after-toplevel-bovinate-hook nil
177 "Hooks run after a toplevel parse.
178 It is not run if the toplevel parse command is called, and buffer does
179 not need to be fully reparsed.
180 For language specific hooks, make sure you define this as a local hook.
182 This hook should not be used any more.
183 Use `semantic-after-toplevel-cache-change-hook' instead.")
184 (make-obsolete-variable 'semantic-after-toplevel-bovinate-hook nil
"23.2")
186 (defvar semantic-after-toplevel-cache-change-hook nil
187 "Hooks run after the buffer tag list has changed.
188 This list will change when a buffer is reparsed, or when the tag list
189 in a buffer is cleared. It is *NOT* called if the current tag list is
192 Hook functions must take one argument, which is the new list of tags
193 associated with this buffer.
195 For language specific hooks, make sure you define this as a local hook.")
197 (defvar semantic-before-toplevel-cache-flush-hook nil
198 "Hooks run before the toplevel tag cache is flushed.
199 For language specific hooks, make sure you define this as a local
200 hook. This hook is called before a corresponding
201 `semantic-after-toplevel-cache-change-hook' which is also called
202 during a flush when the cache is given a new value of nil.")
204 (defcustom semantic-dump-parse nil
205 "When non-nil, dump parsing information."
209 (defvar semantic-parser-name
"LL"
210 "Optional name of the parser used to parse input stream.")
211 (make-variable-buffer-local 'semantic-parser-name
)
213 (defvar semantic--completion-cache nil
214 "Internal variable used by `semantic-complete-symbol'.")
215 (make-variable-buffer-local 'semantic--completion-cache
)
217 ;;; Parse tree state management API
219 (defvar semantic-parse-tree-state
'needs-rebuild
220 "State of the current parse tree.")
221 (make-variable-buffer-local 'semantic-parse-tree-state
)
223 (defmacro semantic-parse-tree-unparseable
()
224 "Indicate that the current buffer is unparseable.
225 It is also true that the parse tree will need either updating or
226 a rebuild. This state will be changed when the user edits the buffer."
227 `(setq semantic-parse-tree-state
'unparseable
))
229 (defmacro semantic-parse-tree-unparseable-p
()
230 "Return non-nil if the current buffer has been marked unparseable."
231 `(eq semantic-parse-tree-state
'unparseable
))
233 (defmacro semantic-parse-tree-set-needs-update
()
234 "Indicate that the current parse tree needs to be updated.
235 The parse tree can be updated by `semantic-parse-changes'."
236 `(setq semantic-parse-tree-state
'needs-update
))
238 (defmacro semantic-parse-tree-needs-update-p
()
239 "Return non-nil if the current parse tree needs to be updated."
240 `(eq semantic-parse-tree-state
'needs-update
))
242 (defmacro semantic-parse-tree-set-needs-rebuild
()
243 "Indicate that the current parse tree needs to be rebuilt.
244 The parse tree must be rebuilt by `semantic-parse-region'."
245 `(setq semantic-parse-tree-state
'needs-rebuild
))
247 (defmacro semantic-parse-tree-needs-rebuild-p
()
248 "Return non-nil if the current parse tree needs to be rebuilt."
249 `(eq semantic-parse-tree-state
'needs-rebuild
))
251 (defmacro semantic-parse-tree-set-up-to-date
()
252 "Indicate that the current parse tree is up to date."
253 `(setq semantic-parse-tree-state nil
))
255 (defmacro semantic-parse-tree-up-to-date-p
()
256 "Return non-nil if the current parse tree is up to date."
257 `(null semantic-parse-tree-state
))
259 ;;; Interfacing with the system
261 (defcustom semantic-inhibit-functions nil
262 "List of functions to call with no arguments before Semantic is setup.
263 If any of these functions returns non-nil, the current buffer is not
264 setup to use Semantic."
268 (defcustom semantic-new-buffer-setup-functions
269 '((c-mode . semantic-default-c-setup
)
270 (c++-mode . semantic-default-c-setup
)
271 (html-mode . semantic-default-html-setup
)
272 (java-mode . wisent-java-default-setup
)
273 (js-mode . wisent-javascript-setup-parser
)
274 (python-mode . wisent-python-default-setup
)
275 (scheme-mode . semantic-default-scheme-setup
)
276 (srecode-template-mode . srecode-template-setup-parser
)
277 (texinfo-mode . semantic-default-texi-setup
)
278 (makefile-automake-mode . semantic-default-make-setup
)
279 (makefile-gmake-mode . semantic-default-make-setup
)
280 (makefile-makepp-mode . semantic-default-make-setup
)
281 (makefile-bsdmake-mode . semantic-default-make-setup
)
282 (makefile-imake-mode . semantic-default-make-setup
)
283 (makefile-mode . semantic-default-make-setup
))
284 "Alist of functions to call to set up Semantic parsing in the buffer.
285 Each element has the form (MODE . FN), where MODE is a value of
286 `major-mode' for the buffer and FN is the corresponding function
287 to call, with no arguments, to set up the parser.
289 These functions are called by `semantic-new-buffer-fcn', before
290 `semantic-inhibit-functions'."
292 :type
'(alist :key-type symbol
:value-type function
))
294 (defvar semantic-init-hook nil
295 "Hook run when a buffer is initialized with a parsing table.")
297 (defvar semantic-init-mode-hook nil
298 "Hook run when a buffer of a particular mode is initialized.")
299 (make-variable-buffer-local 'semantic-init-mode-hook
)
301 (defvar semantic-init-db-hook nil
302 "Hook run when a buffer is initialized with a parsing table for DBs.
303 This hook is for database functions which intend to swap in a tag table.
304 This guarantees that the DB will go before other modes that require
305 a parse of the buffer.")
307 (semantic-varalias-obsolete 'semantic-init-hooks
308 'semantic-init-hook
"23.2")
309 (semantic-varalias-obsolete 'semantic-init-mode-hooks
310 'semantic-init-mode-hook
"23.2")
311 (semantic-varalias-obsolete 'semantic-init-db-hooks
312 'semantic-init-db-hook
"23.2")
314 (defvar semantic-new-buffer-fcn-was-run nil
315 "Non-nil after `semantic-new-buffer-fcn' has been executed.")
316 (make-variable-buffer-local 'semantic-new-buffer-fcn-was-run
)
318 (defsubst semantic-active-p
()
319 "Return non-nil if the current buffer was set up for parsing."
320 semantic-new-buffer-fcn-was-run
)
322 (defsubst semantic-error-if-unparsed
()
323 "Raise an error if current buffer was not parsed by Semantic."
324 (unless semantic-new-buffer-fcn-was-run
325 (error "Buffer was not parsed by Semantic.")))
327 (defsubst semantic--umatched-syntax-needs-refresh-p
()
328 "Return non-nil if the unmatched syntax cache needs a refresh.
329 That is, if it is dirty or if the current parse tree isn't up to date."
330 (or semantic-unmatched-syntax-cache-check
331 (not (semantic-parse-tree-up-to-date-p))))
333 (defun semantic-new-buffer-fcn ()
334 "Setup the current buffer to use Semantic.
335 If the major mode is ready for Semantic, and no
336 `semantic-inhibit-functions' disabled it, the current buffer is setup
337 to use Semantic, and `semantic-init-hook' is run."
338 ;; In upstream Semantic, the parser setup functions are called from
339 ;; mode hooks. In the version bundled with Emacs, we do it here.
340 (let ((entry (assq major-mode semantic-new-buffer-setup-functions
)))
342 (funcall (cdr entry
))))
343 ;; Do stuff if semantic was activated by a mode hook in this buffer,
344 ;; and not afterwards disabled.
345 (when (and semantic--parse-table
346 (not (semantic-active-p))
347 (not (run-hook-with-args-until-success
348 'semantic-inhibit-functions
)))
349 ;; Make sure that if this buffer is cloned, our tags and overlays
350 ;; don't go along for the ride.
351 (add-hook 'clone-indirect-buffer-hook
'semantic-clear-toplevel-cache
353 ;; Specify that this function has done its work. At this point
354 ;; we can consider that semantic is active in this buffer.
355 (setq semantic-new-buffer-fcn-was-run t
)
356 ;; Here are some buffer local variables we can initialize ourselves
357 ;; of a mode does not choose to do so.
359 ;; Force this buffer to have its cache refreshed.
360 (semantic-clear-toplevel-cache)
361 ;; Call DB hooks before regular init hooks
362 (run-hooks 'semantic-init-db-hook
)
363 ;; Set up semantic modes
364 (run-hooks 'semantic-init-hook
)
365 ;; Set up major-mode specific semantic modes
366 (run-hooks 'semantic-init-mode-hook
)))
368 (defun semantic-fetch-tags-fast ()
369 "For use in a hook. When only a partial reparse is needed, reparse."
371 (if (semantic-parse-tree-needs-update-p)
372 (semantic-fetch-tags))
374 semantic--buffer-cache
)
379 (condition-case nil
(require 'pp
) (error nil
)))
381 (defvar semantic-edebug nil
382 "When non-nil, activate the interactive parsing debugger.
383 Do not set this yourself. Call `semantic-debug'.")
385 (defsubst semantic-elapsed-time
(start end
)
386 "Copied from elp.el. Was `elp-elapsed-time'.
387 Arguments START and END bound the time being calculated."
388 (float-time (time-subtract end start
)))
390 (defun bovinate (&optional clear
)
391 "Parse the current buffer. Show output in a temp buffer.
392 Optional argument CLEAR will clear the cache before parsing.
393 If CLEAR is negative, it will do a full reparse, and also not display
396 (if clear
(semantic-clear-toplevel-cache))
397 (if (eq clear
'-
) (setq clear -
1))
398 (let* ((start (current-time))
399 (out (semantic-fetch-tags))
400 (end (current-time)))
401 (message "Retrieving tags took %.2f seconds."
402 (semantic-elapsed-time start end
))
403 (when (or (null clear
) (not (listp clear
)))
404 (pop-to-buffer "*Parser Output*")
407 (insert (pp-to-string out
))
408 (goto-char (point-min)))))
410 ;;; Functions of the parser plug-in API
412 ;; Overload these functions to create new types of parsers.
414 (define-overloadable-function semantic-parse-stream
(stream nonterminal
)
415 "Parse STREAM, starting at the first NONTERMINAL rule.
416 For bovine and wisent based parsers, STREAM is from the output of
417 `semantic-lex', and NONTERMINAL is a rule in the appropriate language
419 The default parser table used for bovine or wisent based parsers is
420 `semantic--parse-table'.
422 Must return a list: (STREAM TAGS) where STREAM is the unused elements
423 from STREAM, and TAGS is the list of semantic tags found; usually only
424 one tag is returned with the exception of compound statements.")
426 (define-overloadable-function semantic-parse-changes
()
427 "Reparse changes in the current buffer.
428 The list of changes are tracked as a series of overlays in the buffer.
429 When overloading this function, use `semantic-changes-in-region' to
432 (define-overloadable-function semantic-parse-region
433 (start end
&optional nonterminal depth returnonerror
)
434 "Parse the area between START and END, and return any tags found.
435 If END needs to be extended due to a lexical token being too large, it
436 will be silently ignored.
439 NONTERMINAL is the rule to start parsing at.
440 DEPTH specifies the lexical depth to descend for parsers that use
441 lexical analysis as their first step.
442 RETURNONERROR specifies that parsing should stop on the first
443 unmatched syntax encountered. When nil, parsing skips the syntax,
444 adding it to the unmatched syntax cache.
446 Must return a list of semantic tags which have been cooked
447 \(repositioned properly) but which DO NOT HAVE OVERLAYS associated
448 with them. When overloading this function, use `semantic--tag-expand'
451 (defun semantic-parse-region-default
452 (start end
&optional nonterminal depth returnonerror
)
453 "Parse the area between START and END, and return any tags found.
454 If END needs to be extended due to a lexical token being too large,
455 it will be silently ignored.
457 NONTERMINAL is the rule to start parsing at if it is known.
458 DEPTH specifies the lexical depth to scan.
459 RETURNONERROR specifies that parsing should end when encountering
460 unterminated syntax."
461 (when (or (null semantic--parse-table
) (eq semantic--parse-table t
))
462 ;; If there is no table, or it was set to t, then we are here by
463 ;; some other mistake. Do not throw an error deep in the parser.
464 (error "No support found to parse buffer %S" (buffer-name)))
467 (when (or (< end start
) (> end
(point-max)))
468 (error "Invalid parse region bounds %S, %S" start end
))
469 (semantic-repeat-parse-whole-stream
470 (or (cdr (assq start semantic-lex-block-streams
))
471 (semantic-lex start end depth
))
472 nonterminal returnonerror
)))
474 ;;; Parsing functions
476 (defun semantic-set-unmatched-syntax-cache (unmatched-syntax)
477 "Set the unmatched syntax cache.
478 Argument UNMATCHED-SYNTAX is the syntax to set into the cache."
479 ;; This function is not actually called by the main parse loop.
480 ;; This is intended for use by semanticdb.
481 (setq semantic-unmatched-syntax-cache unmatched-syntax
482 semantic-unmatched-syntax-cache-check nil
)
483 ;; Refresh the display of unmatched syntax tokens if enabled
484 (run-hook-with-args 'semantic-unmatched-syntax-hook
485 semantic-unmatched-syntax-cache
))
487 (defun semantic-clear-unmatched-syntax-cache ()
488 "Clear the cache of unmatched syntax tokens."
489 (setq semantic-unmatched-syntax-cache nil
490 semantic-unmatched-syntax-cache-check t
))
492 (defun semantic-unmatched-syntax-tokens ()
493 "Return the list of unmatched syntax tokens."
494 ;; If the cache need refresh then do a full re-parse.
495 (if (semantic--umatched-syntax-needs-refresh-p)
496 ;; To avoid a recursive call, temporarily disable
497 ;; `semantic-unmatched-syntax-hook'.
498 (let (semantic-unmatched-syntax-hook)
501 (semantic-clear-toplevel-cache)
502 (semantic-fetch-tags))
504 (message "semantic-unmatched-syntax-tokens:\
505 parsing of buffer canceled"))
507 semantic-unmatched-syntax-cache
)
509 (defun semantic-clear-toplevel-cache ()
510 "Clear the toplevel tag cache for the current buffer.
511 Clearing the cache will force a complete reparse next time a tag list
514 (run-hooks 'semantic-before-toplevel-cache-flush-hook
)
515 (setq semantic--buffer-cache nil
)
516 (semantic-clear-unmatched-syntax-cache)
517 (semantic-clear-parser-warnings)
518 ;; Nuke all semantic overlays. This is faster than deleting based
519 ;; on our data structure.
520 (let ((l (semantic-overlay-lists)))
521 (mapc 'semantic-delete-overlay-maybe
(car l
))
522 (mapc 'semantic-delete-overlay-maybe
(cdr l
))
524 (semantic-parse-tree-set-needs-rebuild)
525 ;; Remove this hook which tracks if a buffer is up to date or not.
526 (remove-hook 'after-change-functions
'semantic-change-function t
)
527 ;; Old model. Delete someday.
528 ;;(run-hooks 'semantic-after-toplevel-bovinate-hook)
530 (run-hook-with-args 'semantic-after-toplevel-cache-change-hook
531 semantic--buffer-cache
)
533 (setq semantic--completion-cache nil
))
535 (defvar semantic-bovinate-nonterminal-check-obarray
)
537 (defun semantic--set-buffer-cache (tagtable)
538 "Set the toplevel tag cache to TAGTABLE."
539 (setq semantic--buffer-cache tagtable
540 semantic-unmatched-syntax-cache-check nil
)
541 ;; This is specific to the bovine parser.
542 (set (make-local-variable 'semantic-bovinate-nonterminal-check-obarray
)
544 (semantic-parse-tree-set-up-to-date)
545 (semantic-make-local-hook 'after-change-functions
)
546 (add-hook 'after-change-functions
'semantic-change-function nil t
)
547 (run-hook-with-args 'semantic-after-toplevel-cache-change-hook
548 semantic--buffer-cache
)
549 (setq semantic--completion-cache nil
)
550 ;; Refresh the display of unmatched syntax tokens if enabled
551 (run-hook-with-args 'semantic-unmatched-syntax-hook
552 semantic-unmatched-syntax-cache
)
553 ;; Old Semantic 1.3 hook API. Maybe useful forever?
554 (run-hooks 'semantic-after-toplevel-bovinate-hook
)
557 (defvar semantic-working-type
'percent
558 "The type of working message to use when parsing.
559 'percent means we are doing a linear parse through the buffer.
560 'dynamic means we are reparsing specific tags.")
561 (semantic-varalias-obsolete 'semantic-bovination-working-type
562 'semantic-working-type
"23.2")
564 (defvar semantic-minimum-working-buffer-size
(* 1024 5)
565 "The minimum size of a buffer before working messages are displayed.
566 Buffers smaller than this will parse silently.
567 Buffers larger than this will display the working progress bar.")
569 (defsubst semantic-parser-working-message
(&optional arg
)
570 "Return the message string displayed while parsing.
571 If optional argument ARG is non-nil it is appended to the message
574 (if arg
(format " %s" arg
))
575 (if semantic-parser-name
(format " (%s)" semantic-parser-name
))
578 ;;; Application Parser Entry Points
580 ;; The best way to call the parser from programs is via
581 ;; `semantic-fetch-tags'. This, in turn, uses other internal
582 ;; API functions which plug-in parsers can take advantage of.
584 (defun semantic-fetch-tags ()
585 "Fetch semantic tags from the current buffer.
586 If the buffer cache is up to date, return that.
587 If the buffer cache is out of date, attempt an incremental reparse.
588 If the buffer has not been parsed before, or if the incremental reparse
589 fails, then parse the entire buffer.
590 If a lexical error had been previously discovered and the buffer
591 was marked unparseable, then do nothing, and return the cache."
593 ;; Is this a semantic enabled buffer?
595 ;; Application hooks say the buffer is safe for parsing
596 (run-hook-with-args-until-failure
597 'semantic-before-toplevel-bovination-hook
)
598 (run-hook-with-args-until-failure
599 'semantic--before-fetch-tags-hook
)
600 ;; If the buffer was previously marked unparseable,
601 ;; then don't waste our time.
602 (not (semantic-parse-tree-unparseable-p))
603 ;; The parse tree actually needs to be refreshed
604 (not (semantic-parse-tree-up-to-date-p))
606 (let* ((gc-cons-threshold (max gc-cons-threshold
10000000))
607 (semantic-lex-block-streams nil
)
612 ;;;; Try the incremental parser to do a fast update.
613 ((semantic-parse-tree-needs-update-p)
614 (setq res
(semantic-parse-changes))
615 (if (semantic-parse-tree-needs-rebuild-p)
616 ;; If the partial reparse fails, jump to a full reparse.
617 (semantic-fetch-tags)
618 ;; Clear the cache of unmatched syntax tokens
622 ;; Move this into the incremental parser. This is a bug.
624 (semantic-clear-unmatched-syntax-cache)
625 (run-hook-with-args ;; Let hooks know the updated tags
626 'semantic-after-partial-cache-change-hook res
))
627 (setq semantic--completion-cache nil
))
629 ;;;; Parse the whole system.
630 ((semantic-parse-tree-needs-rebuild-p)
631 ;; Use Emacs's built-in progress-reporter (only interactive).
633 (setq res
(semantic-parse-region (point-min) (point-max)))
634 (let ((semantic--progress-reporter
635 (and (>= (point-max) semantic-minimum-working-buffer-size
)
636 (eq semantic-working-type
'percent
)
637 (make-progress-reporter
638 (semantic-parser-working-message (buffer-name))
640 (setq res
(semantic-parse-region (point-min) (point-max)))
641 (if semantic--progress-reporter
642 (progress-reporter-done semantic--progress-reporter
))))
644 ;; Clear the caches when we see there were no errors.
645 ;; But preserve the unmatched syntax cache and warnings!
646 (let (semantic-unmatched-syntax-cache
647 semantic-unmatched-syntax-cache-check
648 semantic-parser-warnings
)
649 (semantic-clear-toplevel-cache))
650 ;; Set up the new overlays
651 (semantic--tag-link-list-to-buffer res
)
652 ;; Set up the cache with the new results
653 (semantic--set-buffer-cache res
)
656 ;; Always return the current parse tree.
657 semantic--buffer-cache
)
659 (defun semantic-refresh-tags-safe ()
660 "Refresh the current buffer's tags safely.
662 Return non-nil if the refresh was successful.
663 Return nil if there is some sort of syntax error preventing a reparse.
665 Does nothing if the current buffer doesn't need reparsing."
667 ;; These checks actually occur in `semantic-fetch-tags', but if we
668 ;; do them here, then all the bovination hooks are not run, and
669 ;; we save lots of time.
671 ;; If the buffer was previously marked unparseable,
672 ;; then don't waste our time.
673 ((semantic-parse-tree-unparseable-p)
675 ;; The parse tree is already ok.
676 ((semantic-parse-tree-up-to-date-p)
679 (let* ((inhibit-quit nil
)
684 ;; Perform the parsing.
686 (when (semantic-lex-catch-errors safe-refresh
687 (save-excursion (semantic-fetch-tags))
689 ;; If we are here, it is because the lexical step failed,
690 ;; probably due to unterminated lists or something like that.
692 ;; We do nothing, and just wait for the next idle timer
693 ;; to go off. In the meantime, remember this, and make sure
694 ;; no other idle services can get executed.
695 (setq lexically-safe nil
))
698 ;; Return if we are lexically safe
701 (defun semantic-bovinate-toplevel (&optional ignored
)
702 "Backward compatibility function."
703 (semantic-fetch-tags))
704 (make-obsolete 'semantic-bovinate-toplevel
'semantic-fetch-tags
"23.2")
706 ;; Another approach is to let Emacs call the parser on idle time, when
707 ;; needed, use `semantic-fetch-available-tags' to only retrieve
708 ;; available tags, and setup the `semantic-after-*-hook' hooks to
709 ;; synchronize with new tags when they become available.
711 (defsubst semantic-fetch-available-tags
()
712 "Fetch available semantic tags from the current buffer.
713 That is, return tags currently in the cache without parsing the
715 Parse operations happen asynchronously when needed on Emacs idle time.
716 Use the `semantic-after-toplevel-cache-change-hook' and
717 `semantic-after-partial-cache-change-hook' hooks to synchronize with
718 new tags when they become available."
719 semantic--buffer-cache
)
721 ;;; Iterative parser helper function
723 ;; Iterative parsers are better than rule-based iterative functions
724 ;; in that they can handle obscure errors more cleanly.
726 ;; `semantic-repeat-parse-whole-stream' abstracts this action for
727 ;; other parser centric routines.
729 (defun semantic-repeat-parse-whole-stream
730 (stream nonterm
&optional returnonerror
)
731 "Iteratively parse the entire stream STREAM starting with NONTERM.
732 Optional argument RETURNONERROR indicates that the parser should exit
733 with the current results on a parse error.
734 This function returns semantic tags without overlays."
736 (case-fold-search semantic-case-fold
)
739 (setq nontermsym
(semantic-parse-stream stream nonterm
)
740 tag
(car (cdr nontermsym
)))
742 (error "Parse error @ %d" (car (cdr (car stream
)))))
743 (if (eq (car nontermsym
) stream
)
744 (error "Parser error: Infinite loop?"))
749 ;; Set the 'reparse-symbol property to
750 ;; NONTERM unless it was already setup
752 (or (semantic--tag-get-property
754 (semantic--tag-put-property
755 tag
'reparse-symbol nonterm
))
757 (semantic--tag-expand tag
))
758 result
(append result tag
))
759 ;; No error in this case, a purposeful nil means don't
764 ;; The current item in the stream didn't match, so add it to
765 ;; the list of syntax items which didn't match.
766 (setq semantic-unmatched-syntax-cache
767 (cons (car stream
) semantic-unmatched-syntax-cache
))
769 ;; Designated to ignore.
770 (setq stream
(car nontermsym
))
772 ;; Use Emacs's built-in progress reporter:
773 (and (boundp 'semantic--progress-reporter
)
774 semantic--progress-reporter
775 (eq semantic-working-type
'percent
)
776 (progress-reporter-update
777 semantic--progress-reporter
778 (/ (* 100 (semantic-lex-token-start (car stream
)))
782 ;;; Parsing Warnings:
784 ;; Parsing a buffer may result in non-critical things that we should
785 ;; alert the user to without interrupting the normal flow.
787 ;; Any parser can use this API to provide a list of warnings during a
788 ;; parse which a user may want to investigate.
789 (defvar semantic-parser-warnings nil
790 "A list of parser warnings since the last full reparse.")
791 (make-variable-buffer-local 'semantic-parser-warnings
)
793 (defun semantic-clear-parser-warnings ()
794 "Clear the current list of parser warnings for this buffer."
795 (setq semantic-parser-warnings nil
))
797 (defun semantic-push-parser-warning (warning start end
)
798 "Add a parser WARNING that covers text from START to END."
799 (setq semantic-parser-warnings
800 (cons (cons warning
(cons start end
))
801 semantic-parser-warnings
)))
803 (defun semantic-dump-parser-warnings ()
804 "Dump any parser warnings."
806 (if semantic-parser-warnings
807 (let ((pw semantic-parser-warnings
))
808 (pop-to-buffer "*Parser Warnings*")
811 (insert (pp-to-string pw
))
812 (goto-char (point-min)))
813 (message "No parser warnings.")))
819 ;; Semantic 1.x parser action helper functions, used by some parsers.
820 ;; Please move away from these functions, and try using semantic 2.x
821 ;; interfaces instead.
823 (defsubst semantic-bovinate-region-until-error
824 (start end nonterm
&optional depth
)
825 "NOTE: Use `semantic-parse-region' instead.
827 Bovinate between START and END starting with NONTERM.
828 Optional DEPTH specifies how many levels of parenthesis to enter.
829 This command will parse until an error is encountered, and return
830 the list of everything found until that moment.
831 This is meant for finding variable definitions at the beginning of
832 code blocks in methods. If `bovine-inner-scope' can also support
833 commands, use `semantic-bovinate-from-nonterminal-full'."
834 (semantic-parse-region start end nonterm depth t
))
835 (make-obsolete 'semantic-bovinate-region-until-error
836 'semantic-parse-region
"23.2")
838 (defsubst semantic-bovinate-from-nonterminal
839 (start end nonterm
&optional depth length
)
840 "Bovinate from within a nonterminal lambda from START to END.
841 Argument NONTERM is the nonterminal symbol to start with.
842 Optional argument DEPTH is the depth of lists to dive into. When used
843 in a `lambda' of a MATCH-LIST, there is no need to include a START and
845 Optional argument LENGTH specifies we are only interested in LENGTH
847 (car-safe (cdr (semantic-parse-stream
848 (semantic-lex start end
(or depth
1) length
)
851 (defsubst semantic-bovinate-from-nonterminal-full
852 (start end nonterm
&optional depth
)
853 "NOTE: Use `semantic-parse-region' instead.
855 Bovinate from within a nonterminal lambda from START to END.
856 Iterates until all the space between START and END is exhausted.
857 Argument NONTERM is the nonterminal symbol to start with.
858 If NONTERM is nil, use `bovine-block-toplevel'.
859 Optional argument DEPTH is the depth of lists to dive into.
860 When used in a `lambda' of a MATCH-LIST, there is no need to include
861 a START and END part."
862 (semantic-parse-region start end nonterm
(or depth
1)))
863 (make-obsolete 'semantic-bovinate-from-nonterminal-full
864 'semantic-parse-region
"23.2")
868 (defun semantic-force-refresh ()
869 "Force a full refresh of the current buffer's tags.
870 Throw away all the old tags, and recreate the tag database."
872 (semantic-clear-toplevel-cache)
873 (semantic-fetch-tags)
874 (message "Buffer reparsed."))
876 (defvar semantic-mode-map
877 (let ((map (make-sparse-keymap)))
879 ;; (define-key km "f" 'senator-search-set-tag-class-filter)
880 ;; (define-key km "i" 'senator-isearch-toggle-semantic-mode)
881 (define-key map
"\C-c,j" 'semantic-complete-jump-local
)
882 (define-key map
"\C-c,J" 'semantic-complete-jump
)
883 (define-key map
"\C-c,m" 'semantic-complete-jump-local-members
)
884 (define-key map
"\C-c,g" 'semantic-symref-symbol
)
885 (define-key map
"\C-c,G" 'semantic-symref
)
886 (define-key map
"\C-c,p" 'senator-previous-tag
)
887 (define-key map
"\C-c,n" 'senator-next-tag
)
888 (define-key map
"\C-c,u" 'senator-go-to-up-reference
)
889 (define-key map
"\C-c, " 'semantic-complete-analyze-inline
)
890 (define-key map
"\C-c,\C-w" 'senator-kill-tag
)
891 (define-key map
"\C-c,\M-w" 'senator-copy-tag
)
892 (define-key map
"\C-c,\C-y" 'senator-yank-tag
)
893 (define-key map
"\C-c,r" 'senator-copy-tag-to-register
)
894 (define-key map
"\C-c,," 'semantic-force-refresh
)
895 (define-key map
[?\C-c ?
, up
] 'senator-transpose-tags-up
)
896 (define-key map
[?\C-c ?
, down
] 'senator-transpose-tags-down
)
897 (define-key map
"\C-c,l" 'semantic-analyze-possible-completions
)
898 ;; This hack avoids showing the CEDET menu twice if ede-minor-mode
899 ;; and Semantic are both enabled. Is there a better way?
900 (define-key map
[menu-bar cedet-menu
]
901 (list 'menu-item
"Development" cedet-menu-map
902 :enable
(quote (not (and menu-bar-mode
903 (bound-and-true-p global-ede-mode
))))))
904 ;; (define-key km "-" 'senator-fold-tag)
905 ;; (define-key km "+" 'senator-unfold-tag)
908 ;; Activate the Semantic items in cedet-menu-map
909 (let ((navigate-menu (make-sparse-keymap "Navigate Tags"))
910 (edit-menu (make-sparse-keymap "Edit Tags")))
912 ;; Edit Tags submenu:
913 (define-key edit-menu
[semantic-analyze-possible-completions
]
914 '(menu-item "List Completions" semantic-analyze-possible-completions
915 :enable
(semantic-active-p)
916 :help
"Display a list of completions for the tag at point"))
917 (define-key edit-menu
[semantic-complete-analyze-inline
]
918 '(menu-item "Complete Tag Inline" semantic-complete-analyze-inline
919 :enable
(semantic-active-p)
920 :help
"Display inline completion for the tag at point"))
921 (define-key edit-menu
[semantic-completion-separator
]
923 (define-key edit-menu
[senator-transpose-tags-down
]
924 '(menu-item "Transpose Tags Down" senator-transpose-tags-down
925 :enable
(and (semantic-active-p)
926 (semantic-current-tag))
927 :help
"Transpose the current tag and the next tag"))
928 (define-key edit-menu
[senator-transpose-tags-up
]
929 '(menu-item "Transpose Tags Up" senator-transpose-tags-up
930 :enable
(and (semantic-active-p)
931 (semantic-current-tag))
932 :help
"Transpose the current tag and the previous tag"))
933 (define-key edit-menu
[semantic-edit-separator
]
935 (define-key edit-menu
[senator-yank-tag
]
936 '(menu-item "Yank Tag" senator-yank-tag
937 :enable
(and (boundp 'senator-tag-ring
)
938 (not (ring-empty-p senator-tag-ring
)))
939 :help
"Yank the head of the tag ring into the buffer"))
940 (define-key edit-menu
[senator-copy-tag-to-register
]
941 '(menu-item "Copy Tag To Register" senator-copy-tag-to-register
942 :enable
(and (semantic-active-p)
943 (semantic-current-tag))
944 :help
"Yank the head of the tag ring into the buffer"))
945 (define-key edit-menu
[senator-copy-tag
]
946 '(menu-item "Copy Tag" senator-copy-tag
947 :enable
(and (semantic-active-p)
948 (semantic-current-tag))
949 :help
"Copy the current tag to the tag ring"))
950 (define-key edit-menu
[senator-kill-tag
]
951 '(menu-item "Kill Tag" senator-kill-tag
952 :enable
(and (semantic-active-p)
953 (semantic-current-tag))
954 :help
"Kill the current tag, and copy it to the tag ring"))
956 ;; Navigate Tags submenu:
957 (define-key navigate-menu
[senator-narrow-to-defun
]
958 '(menu-item "Narrow to Tag" senator-narrow-to-defun
959 :enable
(and (semantic-active-p)
960 (semantic-current-tag))
961 :help
"Narrow the buffer to the bounds of the current tag"))
962 (define-key navigate-menu
[semantic-narrow-to-defun-separator
]
964 (define-key navigate-menu
[semantic-symref-symbol
]
965 '(menu-item "Find Tag References..." semantic-symref-symbol
966 :enable
(semantic-active-p)
967 :help
"Read a tag and list the references to it"))
968 (define-key navigate-menu
[semantic-complete-jump
]
969 '(menu-item "Find Tag Globally..." semantic-complete-jump
970 :enable
(semantic-active-p)
971 :help
"Read a tag name and find it in the current project"))
972 (define-key navigate-menu
[semantic-complete-jump-local-members
]
973 '(menu-item "Find Local Members ..." semantic-complete-jump-local-members
974 :enable
(semantic-active-p)
975 :help
"Read a tag name and find a local member with that name"))
976 (define-key navigate-menu
[semantic-complete-jump-local
]
977 '(menu-item "Find Tag in This Buffer..." semantic-complete-jump-local
978 :enable
(semantic-active-p)
979 :help
"Read a tag name and find it in this buffer"))
980 (define-key navigate-menu
[semantic-navigation-separator
]
982 (define-key navigate-menu
[senator-go-to-up-reference
]
983 '(menu-item "Parent Tag" senator-go-to-up-reference
984 :enable
(semantic-active-p)
985 :help
"Navigate up one reference by tag"))
986 (define-key navigate-menu
[senator-next-tag
]
987 '(menu-item "Next Tag" senator-next-tag
988 :enable
(semantic-active-p)
989 :help
"Go to the next tag"))
990 (define-key navigate-menu
[senator-previous-tag
]
991 '(menu-item "Previous Tag" senator-previous-tag
992 :enable
(semantic-active-p)
993 :help
"Go to the previous tag"))
995 ;; Top level menu items:
996 (define-key cedet-menu-map
[semantic-force-refresh
]
997 '(menu-item "Reparse Buffer" semantic-force-refresh
998 :help
"Force a full reparse of the current buffer"
999 :visible semantic-mode
1000 :enable
(semantic-active-p)))
1001 (define-key cedet-menu-map
[semantic-edit-menu
]
1002 `(menu-item "Edit Tags" ,edit-menu
1003 :visible semantic-mode
))
1004 (define-key cedet-menu-map
[navigate-menu
]
1005 `(menu-item "Navigate Tags" ,navigate-menu
1006 :visible semantic-mode
))
1007 (define-key cedet-menu-map
[semantic-options-separator
]
1009 (define-key cedet-menu-map
[global-semantic-highlight-func-mode
]
1010 '(menu-item "Highlight Current Function" global-semantic-highlight-func-mode
1011 :help
"Highlight the tag at point"
1012 :visible semantic-mode
1013 :button
(:toggle . global-semantic-highlight-func-mode
)))
1014 (define-key cedet-menu-map
[global-semantic-stickyfunc-mode
]
1015 '(menu-item "Stick Top Tag to Headerline" global-semantic-stickyfunc-mode
1016 :help
"Stick the tag scrolled off the top of the buffer into the header line"
1017 :visible semantic-mode
1018 :button
(:toggle .
(bound-and-true-p
1019 global-semantic-stickyfunc-mode
))))
1020 (define-key cedet-menu-map
[global-semantic-decoration-mode
]
1021 '(menu-item "Decorate Tags" global-semantic-decoration-mode
1022 :help
"Decorate tags based on tag attributes"
1023 :visible semantic-mode
1024 :button
(:toggle .
(bound-and-true-p
1025 global-semantic-decoration-mode
))))
1026 (define-key cedet-menu-map
[global-semantic-idle-completions-mode
]
1027 '(menu-item "Show Tag Completions" global-semantic-idle-completions-mode
1028 :help
"Show tag completions when idle"
1029 :visible semantic-mode
1030 :enable global-semantic-idle-scheduler-mode
1031 :button
(:toggle . global-semantic-idle-completions-mode
)))
1032 (define-key cedet-menu-map
[global-semantic-idle-summary-mode
]
1033 '(menu-item "Show Tag Summaries" global-semantic-idle-summary-mode
1034 :help
"Show tag summaries when idle"
1035 :visible semantic-mode
1036 :enable global-semantic-idle-scheduler-mode
1037 :button
(:toggle . global-semantic-idle-summary-mode
)))
1038 (define-key cedet-menu-map
[global-semantic-idle-scheduler-mode
]
1039 '(menu-item "Reparse When Idle" global-semantic-idle-scheduler-mode
1040 :help
"Keep a buffer's parse tree up to date when idle"
1041 :visible semantic-mode
1042 :button
(:toggle . global-semantic-idle-scheduler-mode
)))
1043 (define-key cedet-menu-map
[global-semanticdb-minor-mode
]
1044 '(menu-item "Semantic Database" global-semanticdb-minor-mode
1045 :help
"Store tag information in a database"
1046 :visible semantic-mode
1047 :button
(:toggle . global-semanticdb-minor-mode
))))
1049 ;; The `semantic-mode' command, in conjunction with the
1050 ;; `semantic-default-submodes' variable, toggles Semantic's various
1051 ;; auxiliary minor modes.
1053 (defvar semantic-load-system-cache-loaded nil
1054 "Non-nil when the Semantic system caches have been loaded.
1055 Prevent this load system from loading files in twice.")
1057 (defconst semantic-submode-list
1058 '(global-semantic-highlight-func-mode
1059 global-semantic-decoration-mode
1060 global-semantic-stickyfunc-mode
1061 global-semantic-idle-completions-mode
1062 global-semantic-idle-scheduler-mode
1063 global-semanticdb-minor-mode
1064 global-semantic-idle-summary-mode
1065 global-semantic-mru-bookmark-mode
1066 global-cedet-m3-minor-mode
1067 global-semantic-idle-local-symbol-highlight-mode
1068 global-semantic-highlight-edits-mode
1069 global-semantic-show-unmatched-syntax-mode
1070 global-semantic-show-parser-state-mode
)
1071 "List of auxiliary minor modes in the Semantic package.")
1074 (defcustom semantic-default-submodes
1075 '(global-semantic-idle-scheduler-mode global-semanticdb-minor-mode
)
1076 "List of auxiliary Semantic minor modes enabled by `semantic-mode'.
1077 The possible elements of this list include the following:
1079 `global-semanticdb-minor-mode' - Maintain tag database.
1080 `global-semantic-idle-scheduler-mode' - Reparse buffer when idle.
1081 `global-semantic-idle-summary-mode' - Show summary of tag at point.
1082 `global-semantic-idle-completions-mode' - Show completions when idle.
1083 `global-semantic-decoration-mode' - Additional tag decorations.
1084 `global-semantic-highlight-func-mode' - Highlight the current tag.
1085 `global-semantic-stickyfunc-mode' - Show current fun in header line.
1086 `global-semantic-mru-bookmark-mode' - Provide `switch-to-buffer'-like
1087 keybinding for tag names.
1088 `global-cedet-m3-minor-mode' - A mouse 3 context menu.
1089 `global-semantic-idle-local-symbol-highlight-mode' - Highlight references
1090 of the symbol under point.
1091 The following modes are more targeted at people who want to see
1092 some internal information of the semantic parser in action:
1093 `global-semantic-highlight-edits-mode' - Visualize incremental parser by
1094 highlighting not-yet parsed changes.
1095 `global-semantic-show-unmatched-syntax-mode' - Highlight unmatched lexical
1097 `global-semantic-show-parser-state-mode' - Display the parser cache state."
1099 :type
`(set ,@(mapcar (lambda (c) (list 'const c
))
1100 semantic-submode-list
)))
1103 (define-minor-mode semantic-mode
1104 "Toggle parser features (Semantic mode).
1105 With a prefix argument ARG, enable Semantic mode if ARG is
1106 positive, and disable it otherwise. If called from Lisp, enable
1107 Semantic mode if ARG is omitted or nil.
1109 In Semantic mode, Emacs parses the buffers you visit for their
1110 semantic content. This information is used by a variety of
1111 auxiliary minor modes, listed in `semantic-default-submodes';
1112 all the minor modes in this list are also enabled when you enable
1115 \\{semantic-mode-map}"
1119 ;; Turn on Semantic mode
1121 ;; Enable all the global auxiliary minor modes in
1122 ;; `semantic-submode-list'.
1123 (dolist (mode semantic-submode-list
)
1124 (if (memq mode semantic-default-submodes
)
1126 (unless semantic-load-system-cache-loaded
1127 (setq semantic-load-system-cache-loaded t
)
1128 (when (and (boundp 'semanticdb-default-system-save-directory
)
1129 (stringp semanticdb-default-system-save-directory
)
1130 (file-exists-p semanticdb-default-system-save-directory
))
1131 (require 'semantic
/db-ebrowse
)
1132 (semanticdb-load-ebrowse-caches)))
1133 (add-hook 'mode-local-init-hook
'semantic-new-buffer-fcn
)
1134 ;; Add semantic-ia-complete-symbol to
1135 ;; completion-at-point-functions, so that it is run from
1137 (add-hook 'completion-at-point-functions
1138 'semantic-completion-at-point-function
)
1140 (define-key cedet-menu-map
[cedet-menu-separator
] '("--")))
1141 (dolist (b (buffer-list))
1142 (with-current-buffer b
1143 (semantic-new-buffer-fcn))))
1144 ;; Disable Semantic features. Removing everything Semantic has
1145 ;; introduced in the buffer is pretty much futile, but we have to
1146 ;; clean the hooks and delete Semantic-related overlays, so that
1147 ;; Semantic can be re-activated cleanly.
1148 (remove-hook 'mode-local-init-hook
'semantic-new-buffer-fcn
)
1149 (remove-hook 'completion-at-point-functions
1150 'semantic-completion-at-point-function
)
1151 (remove-hook 'after-change-functions
1152 'semantic-change-function
)
1153 (define-key cedet-menu-map
[cedet-menu-separator
] nil
)
1154 (define-key cedet-menu-map
[semantic-options-separator
] nil
)
1155 ;; FIXME: handle semanticdb-load-ebrowse-caches
1156 (dolist (mode semantic-submode-list
)
1157 (if (and (boundp mode
) (eval mode
))
1159 ;; Unlink buffer and clear cache
1160 (semantic--tag-unlink-cache-from-buffer)
1161 (setq semantic--buffer-cache nil
)
1162 ;; Make sure we run the setup function if Semantic gets
1164 (setq semantic-new-buffer-fcn-was-run nil
)))
1166 (defun semantic-completion-at-point-function ()
1167 'semantic-ia-complete-symbol
)
1169 ;;; Autoload some functions that are not in semantic/loaddefs
1171 (autoload 'global-semantic-idle-completions-mode
"semantic/idle"
1172 "Toggle global use of `semantic-idle-completions-mode'.
1173 If ARG is positive, enable, if it is negative, disable.
1174 If ARG is nil, then toggle." t nil
)
1176 (autoload 'semantic-idle-completions-mode
"semantic/idle"
1177 "Display a list of possible completions in a tooltip.
1179 This is a minor mode which performs actions during idle time.
1180 With prefix argument ARG, turn on if positive, otherwise off. The
1181 minor mode can be turned on only if semantic feature is available and
1182 the current buffer was set up for parsing. Return non-nil if the
1183 minor mode is enabled." t nil
)
1185 (autoload 'global-semantic-idle-summary-mode
"semantic/idle"
1186 "Toggle global use of `semantic-idle-summary-mode'.
1187 If ARG is positive, enable, if it is negative, disable.
1188 If ARG is nil, then toggle." t nil
)
1190 (autoload 'semantic-idle-summary-mode
"semantic/idle"
1191 "Display a tag summary of the lexical token under the cursor.
1192 Call `semantic-idle-summary-current-symbol-info' for getting the
1193 current tag to display information.
1195 This is a minor mode which performs actions during idle time.
1196 With prefix argument ARG, turn on if positive, otherwise off. The
1197 minor mode can be turned on only if semantic feature is available and
1198 the current buffer was set up for parsing. Return non-nil if the
1199 minor mode is enabled." t nil
)
1201 (autoload 'global-semantic-idle-local-symbol-highlight-mode
"semantic/idle"
1202 "Highlight the tag and symbol references of the symbol under point.
1203 Call `semantic-analyze-current-context' to find the reference tag.
1204 Call `semantic-symref-hits-in-region' to identify local references." t nil
)
1206 (autoload 'srecode-template-setup-parser
"srecode/srecode-template"
1207 "Set up buffer for parsing SRecode template files." t nil
)
1211 ;; Semantic-util is a part of the semantic API. Include it last
1212 ;; because it depends on semantic.
1213 (require 'semantic
/util
)
1215 ;; (require 'semantic/load)
1217 ;;; semantic.el ends here