Книга: Learning GNU Emacs, 3rd Edition

9.4.1 Java Mode

9.4.1 Java Mode

Java mode shares all of the formatting and font features mentioned above, but understands the Java language specifically. You get thrown into Java mode when opening any .java file.

When working in Java mode, you have exactly the same features available as you do in C mode. Syntax highlighting handles Java keywords and syntax when font-lock mode is turned on. You can navigate Java commands using M-a and M-e. When commenting out a region, it uses the C++ style // comments.

You'll notice a small augmentation in the indent alignment commands if you choose to spread your throws or extends clauses over multiple lines. For example, consider the following method declaration:

public Object getNetResource(String host, int port, String resName)
throws IllegalArgumentException,
IOException,
SQLException,
FileNotFoundException
{

If you mark the region and run M-C- to indent the region, it uses a special alignment for the exception list:

public Object getNetResource(String host, int port, String resName)
        throws IllegalArgumentException,
               IOException,
               SQLException,
               FileNotFoundException
{

It all works like it is supposed to—just with Java as the language at the core of the action. However, for more than casual Java editing, you should read the next section on the JDEE.

Оглавление книги

Оглавление статьи/книги

Генерация: 0.707. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз