Node:Non-semantic sources, Next:Hide-show, Previous:Compile-window on demand, Up:Tips and tricks
ECB is mostly designed to display parsing information for files supported by semantic. But from version 1.94 on it also supports other parsing engines like imenu and etags, so also files not supported by semantic but by imenu/etags can be displayed in the Method-buffer of ECB. See Definition of semantic- and non-semantic-sources for a description of "semantic-sources" and "non-semantic-sources".
If support of non-semantic-sources is enabled then ECB will display the contents of all sources which can be displayed by speedbar too. This comes from the fact that ECB uses speedbar-logic to parse sources with imenu or etags.
In most cases imenu-parsing is preferable over etags-parsing because imenu operates on Emacs-buffers and needs no external tool and therefore parsing works also if current contents of a buffer are not saved to disk.
This section describes all important aspects about parsing and displaying file-contents of file-types not supported by semantic but by imenu and/or etags.
Enabling is simply done with the option ecb-process-non-semantic-files
.
ECB offers an option ecb-non-semantic-parsing-function
to
specify on a major-mode basis which parsing-method should be used:
imenu or etags. Normally there should be no need to change this option
but read the documentation of this option (see ecb-non-semantic)
for further details.
IMPORTANT:
speedbar-use-imenu-flag
must be set to not nil
!
ecb-non-semantic-parsing-function
and
speedbar-dynamic-tags-function-list
and - especially for etags -
speedbar-fetch-etags-parse-list
, speedbar-fetch-etags-arguments
and speedbar-fetch-etags-command
.
major-modes
which are not
parse-able, neither by semantic, imenu nor etags. This is no problem
because these files simply have an empty Methods-buffer. But
nevertheless you will get a message "Sorry, no support for a file of
that extension" which comes from the speedbar-library and can not
switched off. Therefore if a major-mode
is known as not
parse-able by semantic, imenu or etags it can be added to the option
ecb-non-semantic-exclude-modes
and then it will be excluded
from being tried to parsed and this (annoying) message will not occur.
In contrast to semantic (see global-semantic-auto-parse-mode
)
there is no built-in mechanism for autom. reparsing
non-semantic-sources and then updating the contents of the
Methods-buffer.
For non-semantic-sources you have always at least to call
ecb-rebuild-methods-buffer
(bound to C-c . r) or saving
the source-file (if ecb-auto-update-methods-after-save
is true)
to update the Method-buffer1.
Depending on the parsing-mechanism the following options have to be switched on so ECB can rebuild the methods-buffer for non-semantic-sources:
The imenu-option imenu-auto-rescan
must be enabled and
imenu-auto-rescan-maxout
has to be set big enough to auto-parse
big files too! But this results not directly in an autom. updated
Method-buffer. This is first done after calling the command
ecb-rebuild-methods-buffer
or saving the source-file (if
ecb-auto-update-methods-after-save
is true).
Only if ecb-auto-save-before-etags-methods-rebuild
is switched on
the command ecb-rebuild-methods-buffer
rebuilds the
method-buffer with current source-contents. See description of this
option for an explanation.
Tip: If you want to program your own real. automatic rescan/reparse/rebuild mechanism for non-semantic-sources you can do:
Adding to after-change-functions
a function F which either runs
itself ecb-rebuild-methods-buffer-for-non-semantic
or which
adds only another function FF to an idle-timer and the function FF
runs ecb-rebuild-methods-buffer-for-non-semantic
. The latter
approach has the advantage that the reparse/rebuild is not performed
immediately after every change but first after Emacs is idle for a
senseful interval (e.g. 4 seconds) after last change. Of course the
function FF has to cancel its own idle-timer at the end, so the next
idle-timer is first started again after the next change (i.e. by
function F which is still contained in after-change-functions
.
For non-semantic-sources ECB uses does no special organizing of tokens in groups and sub-tokens but it completely uses the token-hierarchy the imenu- and etags-parsers of speedbar return. So the displayed token hierarchy can only be customized with some options speedbar offers for this:
speedbar-tag-hierarchy-method
,
speedbar-tag-group-name-minimum-length
,
speedbar-tag-split-minimum-length
and
speedbar-tag-regroup-maximum-length
. See the speedbar
documentation for details about these options.
With the option ecb-method-non-semantic-face
you can define the
face used for displaying the tokens in the Method-buffer for
non-semantic-sources.
ecb-non-semantic-methods-initial-expand
can be useful too.