You can use mmm to integrate java-mode into html-mode. I am not sure if
mmm comes with the latest xemacs dist, but there is a link on
www.xemacs.org where you can get it from
(http://members.tripod.com/gchen2/xemacs/).
I have been using it for months and it works modestly well... though
indentation gets messed up.
I have attached my mmm-html.el for your reference.
--jason
On Mon, 17 Jan 2000, Erez Bashan wrote:
> I am working with Xemacs on JSP pages. Currently I am working either with HTML
> mode or JDE mode, depending whether the page has more Java or HTML in it ...
>
> Anyone already hacked up an JSP mode for Emacs ?
>
> Erez
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>
;;; mmm-html.el
;;; Code:
(require 'mmm)
(require 'cc-mode)
(require 'css-mode)
(require 'javascript-mode)
(defun mmm-detect-style-region ()
(let ((case-fold-search t)
b e m s)
(and (re-search-forward "<style\\(.*\\)>" nil t)
(setq s (downcase (match-string 1))
b (match-end 0)
m (if (string-match "css" s)
'css-mode
'css-mode))
(search-forward "</style>" nil t)
(setq e (match-beginning 0))
(cons m (cons b e))))
)
(defun mmm-detect-script-region ()
(let ((case-fold-search t)
b e m s)
(and (re-search-forward "<script\\(.*\\)>" nil t)
(setq s (downcase (match-string 1))
b (match-end 0)
m (if (string-match "javascript" s)
'javascript-mode
'java-mode))
(search-forward "</script>" nil t)
(setq e (match-beginning 0))
(cons m (cons b e))))
)
;;
;; detect JSP scriptlet regions
;;
(defun mmm-detect-jsp-xml-scriptlet-region ()
(let ((case-fold-search t) b e)
(and
(re-search-forward "<jsp:scriptlet>" nil t)
(setq b (match-end 0))
(search-forward "</jsp:scriptlet>" nil t)
(setq e (match-beginning 0))
(cons 'java-mode (cons b e))))
)
;;
;; detect JSP scriptlet tags (as well as other JSP tags)
;;
(defun mmm-detect-jsp-scriptlet-region ()
(let ((case-fold-search t) b e)
(and
(re-search-forward "<%" nil t)
(setq b (match-end 0))
(search-forward "%>" nil t)
(setq e (match-beginning 0))
(cons 'java-mode (cons b e))))
)
;;
;; initalize all mmm activators
;;
(defun mmm-html-init()
(interactive)
(mmm-activator 'mmm-detect-script-region)
(mmm-activator 'mmm-detect-style-region)
(mmm-activator 'mmm-detect-jsp-scriptlet-region)
(mmm-activator 'mmm-detect-jsp-xml-scriptlet-region)
)
;;
;; initalize and re-fontify
;;
(defun mmm-html-reload()
(interactive)
(mmm-html-init)
(font-lock-fontify-buffer))
;;
;; add hooks
;;
(add-hook 'html-mode-hook
(function (lambda()
(setq line-number-mode t)
(setq column-number-mode t)
(mmm-html-init)
)))
;;
;; add modes
;;
(setq auto-mode-alist
(append '(("\\.js$" . javascript-mode)
("\\.css$" . css-mode)
("\\.jsp$" . html-mode) ; no jsp-mode just yet =(
("\\.jspi$" . html-mode) ; no jsp-mode just yet =(
("\\.htm[l]?$" . html-mode)) auto-mode-alist))
(provide 'mmm-html)
;;;EOF