Next: Hide-show, Previous: Compile-window on demand, Up: Common use-cases [Contents][Index]

### 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:

- If imenu-parsing should be used then the option `speedbar-use-imenu-flag` must be set to not `nil`!
- If some non-semantic-sources are not parsed (i.e. there is an empty Methods-buffer) and you think that they should then maybe they are neither supported by imenu nor by etags or you have to check the options `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`.
- Even with support for semantic-, imenu- and etags-parsing there will remain some file-types rsp. `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.

#### 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-buffer43.

Depending on the parsing-mechanism the following options have to be switched on so ECB can rebuild the methods-buffer for non-semantic-sources:

- imenu:

  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).

- etags:

  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`.

#### 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

### (43)

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

Next: Hide-show, Previous: Compile-window on demand, Up: Common use-cases [Contents][Index]