[3475] in java-interest

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

xemacs java mode (was: Development tools etc.)

daemon@ATHENA.MIT.EDU (Anselm Baird_smith)
Tue Nov 14 08:51:22 1995

Date: Tue, 14 Nov 1995 12:36:48 +0100
From: Anselm Baird_smith <Anselm.Baird_Smith@inria.fr>
To: Horlock.Neil.@.ext06lon@ft.com (Horlock Neil)
Cc: java-interest@java.Eng.Sun.COM
In-Reply-To: <0a876bc0@smtpgate.ft.com>
Reply-To: Anselm Baird-Smith <Anselm.BairdSmith@inria.fr>


Horlock Neil writes:

 > On the subject of dev. tools etc. for Java there is a Java mode for Emacs
 > It is far from complete (it has been cut up from the C++ mode) but to those of
 > you who use emacs it is a good start, it has font-lock (syntax hilites) and
 > other stuff. I got it from my local sunsite (imperial college London) in the
 > /pub/java/contrib/emacs/ directory
 > 
 > Other mirrors will also have it I guess.
 > 
 > NOTE: Xemacs users.
 > I cannot get it to work with xemacs my guess is that the default mode that the
 > java mode inherits from (c++) is not the same lisp package under emacs as it is
 > under xemacs. I may try to fix this, I'll let you know if I do.

You may want to try this, which works for me under xemacs19.13. It is
probably wrong but at least it works for me ;-)

Anselm.

---------
;; java-cust.el

; (load "cplus-md")
; (load "java-mode")
(load "java-f-lock")

(defvar java-mode-map nil "Java mode map")

(if java-mode-map
    ()
    (setq java-mode-map (copy-keymap c++-mode-map))
    (define-key java-mode-map '(meta backspace) 'backward-kill-word)
    (define-key java-mode-map '(meta backward) 'backward-kill-word)
    (define-key java-mode-map '(meta delete) 'backward-kill-word)
    (define-key java-mode-map '(meta control h) 'backward-kill-word) )
    

(defun java-mode ()
  "Major mode for editing java code.
See the documentation for c++-mode:  java-mode is an extension of
c++-mode.
Use the hook java-mode-hook to execute custom code when entering Java
mode.
\\{java-mode-map}"
  (interactive)
  (let ((current-c++-mode-hook (and (boundp 'c++-mode-hook) c++-mode-hook)))
       ;; Temporarily disable the c++-mode hook; don't wanna run
       ;; it when loading up c++-mode.
       (setq c++-mode-hook nil)
       (c++-mode)
       (setq major-mode 'java-mode mode-name "java")
       (use-local-map java-mode-map)
       ;; Restore the original c++-mode-hook.
       (setq c++-mode-hook current-c++-mode-hook)
       (run-hooks 'java-mode-hook)))

(add-hook 'java-mode-hook
	  (function
	   (lambda ()
	     (if (eq major-mode 'java-mode)
		 (progn 
		   (setq font-lock-keywords java-font-lock-keywords)
		   (c-set-offset 'inher-cont '+)
		   (font-lock-fontify-buffer))))))

(provide 'java-cust)

--------
-
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