Filtering Methods - ECB - the Emacs Code Browser
Description: ECB - the Emacs Code Browser

Previous: Filtering History, Up: Filtering the tree-buffers

#### 6.7.4 Applying filters to the Methods-buffer

The commands `ecb-methods-filter`, `ecb-methods-filter-regexp`, `ecb-methods-filter-protection`, `ecb-methods-filter-tagclass`, `ecb-methods-filter-function`, `ecb-methods-filter-delete-last`, `ecb-methods-filter-nofilter` allows to filter the tags/nodes of the Methods-buffer by several criterias. As for the Sources- and the History-buffer the same functionality is also available via the popup-menu of the Methods-buffer.

##### 6.7.4.1 Possible filter-criterias

- Filter by protection: Just insert the protection you want the Methods-buffer being filtered: private, protected or public! For sources not supported by semantic the protection filter will not be offered because these informations are not available for such sources.
- Filter by regexp: Insert the filter as regular expression.
- Filter by tag-class: You can filter by tag-classes. The popup-menu contains mode-dependend tag-filter entries and the command `ecb-methods-filter` offers only the tag-classes of the current mode. This means for sources not supported by semantic the tag-class filter will not be offered. And for semantic-supported sources exactly these tag-classes are offered the semantic-parser for the current major-mode offers. For example texi-sources can only be filtered by the tag-classes “Definitions” and “Sections” and java-sources can be filtered by “Methods”, “Variables”, “Classes” etc. In general the semantic-variable `semantic-symbol->name-assoc-list` is used to get the right tag-classes.
- Filter by a filter-function: Such a function gets two arguments: a tag and the source-buffer of this tag. If the tag should be displayed (i.e. not being filtered out) then the function has to return not nil otherwise nil.
- No special filter: This means to display all tags specified with the option `ecb-show-tokens`. If currently some of the above filters are applied they will be all removed.
- Delete the last added: This removes only the topmost filter-layer, means that filter added last.

Be aware that the tag-list specified by the option `ecb-show-tags` is the basis of all filters, i.e. tags which are excluded by that option will never be shown regardless of the filter type here!

All tags which match the applied filter(s) will be displayed in the Methods-buffer. Such a filter is only applied to the current source-buffer, i.e. each source-buffer can have its own tag-filters.

These tag-filters can also applied to sources which are not supported by the semantic-parser but “only” by imenu or etags. But because for these sources not all information are avaiable the protection- and tag-class filter are not offered with such “non-semantic”-sources. See Non-semantic sources for further details about working with source-files not supported by the semantic-parser.

##### 6.7.4.2 Inverse Filters

But if `ecb-methods-filter` is called with a prefix-argument then an inverse filter is applied to the Methods-buffer, i.e. all tags which do NOT match the choosen filter will be displayed in the Methods-buffer!

##### 6.7.4.3 Layered filters

Per default the choosen filter will be applied on top of already existing filters. This means that filters applied before are combined with the new filter. This behavior can changed via the option `ecb-methods-filter-replace-existing`.

##### 6.7.4.4 Display of currently applied filters

The current active filter will be displayed in the modeline of the Methods-buffer [regexp, prot (= protection), tag-class, function (= filter-function)]. If an inverse filter has been applied then this is signalized by a preceding caret ^. If currently more than 1 filter is applied then always the top-most filter is displayed in the modeline but the fact of more than 1 filter is visualized by the number of the filters - included in parens. You can see all currently applied filters by moving the mouse over the filter-string in modeline of the Methods-buffer: They will displayed as help-echo.

##### 6.7.4.5 Default filters for certain files.

The new option `ecb-default-tag-filter` allow to define default tag-filters for certain files which are applied automatically after loading such a file into a buffer. The possible filters are the same as offered by the command `ecb-methods-filter` and they are applied in the same manner - the only difference is they are applied automatically. The files can be specified on a combined major-mode- and filename-regexp-basis.

Usage-example: This can be used to display in outline-mode files (e.g. `NEWS`) only the level-1-headings by defining a filter regexp “^\* .*”.