Node:Setting up Emacs, Next:First steps, Previous:Installation, Up:Install and first steps
NOTE: Normally it should not necessary for you to bother with the following stuff unless you have problems getting ECB working correctly for you.
To ensure ECB and semantic are working correctly for all by semantic supported languages you have to pay attention to the following aspects concerning your Emacs-setup:
Parsing files is done completely by semantic. ECB just displays the
parsing results. For all needs of ECB semantic is completely setup by
ECB itself, i.e. ECB sets up semantic for you! You have only to add
the installation directory of semantic to your load-path
(in an
appropriate way)!
NOTE: If you setup semantic for yourself following the
recommendations in the installation instructions of semantic then you
have probably added code to your startup-file like:
(setq semantic-load-turn-everything-on t) (require 'semantic-load)
Be aware that this also enables the minor-modes
semantic-show-dirty-mode
and
semantic-show-unmatched-syntax-mode
where the former one
highlights all code which has to be reparsed with dark background
(which results in large portions of dark background ;-) and the latter
one underlines all syntax which can not be parsed. Especially the
former one can be really annoying.
To switch off these modes you can add to your startup-file:
(global-semantic-show-dirty-mode -1) (global-semantic-show-unmatched-syntax-mode -1)
ECB is for browsing source-files and therefore you have to setup your
Emacs-configuration properly so semantic can be activated
automatically for parsing your Emacs-Lisp, C, C++ or Java
buffers1. For this Emacs
must activate the correct major-mode
for the source-files and
Emacs can only do this if the option auto-mode-alist
is setup
correctly. The correct major-modes and possible
file-extensions2 are:
Language | Major-mode |
Extension(s)
|
Emacs Lisp | emacs-lisp-mode | .el
|
C | c-mode | .h, .c
|
C++ | c++-mode | .h, .hxx, .hh, .HH, .cxx, .cpp,
.cc, .CC
|
Java | java-mode or jde-mode (if you use JDEE)
| .java
|
Example: If you want files with extension ".cpp" being c++-parsed by
semantic and ECB, your auto-mode-alist
must contain an entry
like:
("\\.cpp\\'" . c++-mode)
After this ECB will correctly parse your ".cpp"-sources and display all the semantic information in the ECB-methods buffer.
If you have already checked points (1.) and (2.) and if you have still
problems getting ECB/semantic working properly for your sources you
should check the related major-mode hook. Every major-mode X has a
hook with name "X-hook" which is evaluated after activating the
major-mode (see above, 2.), e.g. the hook for the major-mode
c++-mode
is c++-mode-hook
.
Semantic adds automatically during load-time a special
"semantic-setup" to these major-mode hooks3 in form of a
"setup-function". Example: For c and c++ modes semantic adds
semantic-default-c-setup
to c-mode-hook
and
c++-mode-hook
.
If your own Emacs-setup (e.g. in .emacs
or
site-lisp/site-start.el
) overwrites such a major-mode-hook then
semantic can not be activated for this major-mode and in consequence
ECB can not work properly too!
Check if your Emacs-setup uses somewhere setq
for adding code
to a major-mode-hook. IMPORTANT: Use add-hook
instead of
setq
4!
If your source-files are "running" with correct major-mode
and correct major-mode hooks ECB and semantic will do what you expect
them doing!
semantic supports some more ``languages'' like Makefiles etc. but these are the most important ones.
Especially for C++ and C you can use any extension you want but these are the most common ones!
Of course only for major-modes supported by semantic!
setq
replaces/overwrites the current
value of a hook with the new value whereas add-hook
adds the new value to the old-value of the hook!