[4810] in java-interest

home help back first fref pref prev next nref lref last post

Re: Java (C++) mode setup for .emacs

daemon@ATHENA.MIT.EDU (Greg Ewing)
Mon Jan 15 19:35:14 1996

Date: Tue, 16 Jan 1996 09:31:11 +1100
From: grege@optimation.com.au (Greg Ewing)
To: java-interest@java.sun.com

>From quester@indy.net Sat Jan 13 08:11 EST 1996
>Received: from IndyNet.indy.net (root@indynet.indy.net [199.3.65.1]) by yarrina.connect.com.au with ESMTP id XAA29731
  (8.6.12/IDA-1.6 for <grege@optimation.com.au>); Fri, 12 Jan 1996 23:11:40 +1100
Date: Fri, 12 Jan 1996 07:10:16 -0500
X-Sender: quester@indy.net
Mime-Version: 1.0
To: grege@optimation.com.au (Greg Ewing)
From: quester@indy.net (Josh Johnson)
Subject: Re: Java (C++) mode setup for .emacs

>Dear javans,
>
>For an uncomplicated emacs java-mode setup, simply add the following to
your .emacs file:
>
>	; Java mode setup
>	(setq auto-mode-alist (cons '("\\.java$" . c++-mode) auto-mode-alist))
>
>
>It uses your existing c++-mode which is extremely compatible with java
formatting.
>
>GREG
>
>grege@optimation.com.au
>-
>This message was sent to the java-interest mailing list
>Info: send 'help' to java-interest-request@java.sun.com
>

Can     you be more  specific?



----- End Included Message -----

Josh,

The two lines of code (the first line is a comment) are to be added to the .emacs 
file which you will find (as a hidden file) in your root directory. 

Look at your file and locate the first reference to `setq auto-mode-alist'. You 
should be ok if you add the new lines anywhere after this first reference.

Just to check whether you have C++ mode - load any file into emacs then type `meta-x
 (i.e. escape x) c++-mode' and hit return. This will put you into c++ mode. Emacs 
will complain if hasn't got it. You won't see any formatting stuff (colours etc) 
, however, until you do a ctrl-l.

Adding my code to your .emacs means that emacs will now treat any file with a .java 
extension as a c++ file and allow automatic formatting and colouring (e.g. hitting 
tab on any line of code will instantly indent the code correctly).

GREG

grege@optimation.com.au


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post