Emacs is the world's best editor, infinitely configurable and powerful and free. If you're not used to a Unix text editor and want to write programs, emacs is probably best to learn. The information here will show you how to set up emacs to use an Objective C or Java specific mode for editing source code and how to get emacs to colour your source code for you nicely. Emacs can also help you find compilation errors, run a debugger, and even act like a class browser. Documentation for those things are not here, see the Emacs documentation itself.
objc-mode. One of the best things about emacs is that one can load different "major modes" to edit types of files. Major modes making editing files easier by providing structure to your editing. In particular, there are programming language modes that do nice things like indentation for you.
Starting with emacs-19.30, the default C mode is cc-mode.el, a nice rewrite of the original c-mode.el. Luckily for us, cc-mode.el supports Objective C directly. The basic function to invoke it is objc-mode. The following bit of code in your .emacs will cause emacs to automatically enter objc-mode on all files that end in .m or .h:
(setq auto-mode-alist (append '(("\\.h$" . objc-mode) ("\\.m$" . objc-mode)))) |
Highlighting code. Emacs running under X has the ability to colour your source code according to syntax. There are two packages to do this: font-lock and hilit19.
font-lock. emacs-20 and later also has a font-lock mode for Objective-C that supports the method syntax unique to Objective-C. We recommend the use of font-lock, over hilit19, now that the identification of Objective C syntax in emacs is better supported, as font-lock supports 'lazy-fontification' (i.e. as you type fontification), a feature that hilit19 never offered. See the manual provided with emacs for how to turn on this feature to highlight .h and .m files in 'objc-mode' automatically.
jde. The aforementioned cc-mode.el also supports Java directly. But in the Java case we can go one better, with the complete free/open source Integrated Development Environment (IDE) known as the Java Development Environment (jde). It's available from the Sunsite in Denmark