Next: , Previous: Compile-window on demand, Up: Common use-cases


10.13 Parsing and displaying non-semantic sources

ECB is mostly designed to display parsing information for files supported by semantic. But beginning with version 1.94 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.

10.13.1 Enabling parsing and displaying of non-semantic-sources

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:

10.13.2 Automatic rescanning/reparsing of non-semantic-sources

In contrast to semantic (see global-semantic-idle-scheduler-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:

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.

10.13.3 Customizing the display of the tags

For non-semantic-sources ECB uses does no special organizing of tags in groups and sub-tags but it completely uses the tag-hierarchy the imenu- and etags-parsers of speedbar return. So the displayed tag 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 tags in the Method-buffer for non-semantic-sources.

ecb-non-semantic-methods-initial-expand can be useful too.


Footnotes

[1] Maybe future versions of ECB (> 1.94) will offer an autom. mechanism for this.