HP-UX Java™ - Emacs Editor

» Back to table of contents

Emacs is an open source editor that accepts macros to customize the display for specific uses. There is a macro (JDE) available that customizes it for Java™ code. The customization consists of color-coding tokens and formatting the code for readability. It requires a profile file for startup on HP-UX which can be found in this document. The emacs editor and Java™ macro can be downloaded from the following public sites:

Documentation can be found on the GNU Emacs website at: http://directory.fsf.org/emacs.html. You can also get help via the Emacs> M-x zapropos and Ctl-h commands.

Sample .emacs configuration file.

Author: Prabhakar Rao
home directory with respect to emacs: my home dir in this case

(setq default-directory (expand-file-name "/home/prao"))
setting default mode to text mode
(setq default-major-mode 'text-mode)
(add-hook 'tfollowing-hook 'turn-on-auto-fill)

the following are for the text and background when highlighted by us
(set-face-backgroundighlighted by us
(set-face-background 'region    "green")
(set-face-foreground 'region    "red")

Update emacs lisp load path for NT (for UNIX, just change c:\EmacsNT to ~/pathtoEmacs)
(add-to-list 'load-path (expand-file-name "c:/EmacsNT/emacs-20.5/site/jde/jde-2.2.4/lisp"))
(add-to-list 'load-path (expand-file-name "c:/EmacsNT/emacs-20.5/site/semantic/semantic-1.2.1"))
(add-to-list 'load-path (expand-file-name "c:/EmacsNT/emacs-20.5/site/speedbar/speedbar-0.12"))
(add-to-list 'load-path (expand-file-name "c:/EmacsNT/emacs-20.5/site/elib/elib-0.06/library"))

If you want Emacs to defer loading the JDE until you open a Java™ file, remove the semi-colons in the following lines before the next topic starts, else just leave the line that reads: (require 'jde) as it is which will load JDE directly on loading emacs.
(setq defer-loading-jde t)
(if d/>     (autoload 'jde-mode "jde" "JDE mode." t)
     (setq auto-mode-alist
       (append
    '(("\\.java\\'" . jde-mode))
          auto-mode-alist)))
  (require 'jde)
)

set the basic indentation for Java™ source files to two spaces.
(defun my-jde-mode-hook ()
   (setq c-basic-offset 2))
(custom-set-variables
  '(column-number-mode t)
  '(explicit-shell-file-name nil)
  '(line-number-mode t)
  '(font-lock-mode t nil (font-lock)))
(custom-set-faces)