help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [h-e-w] Re: Emacs and JSP


From: Sprenger, Karel
Subject: RE: [h-e-w] Re: Emacs and JSP
Date: Fri, 6 Dec 2002 17:12:05 +0100

Galen,

Yes, it does!  In fact I now have the following in my .emacs:

(require 'mmm-mode)
(require 'mmm-sample)
(mmm-add-find-file-hook)

;; Use jsp-helper-mode + mmm-mode for JSP files
(add-to-list 'auto-mode-alist '("\\.jsp$" . jsp-html-helper-mode))
;; Use mmm-mode to activate jde mode for the Java part of the JSP file
;; and javascript mode for any JavaScript code in it.
(mmm-add-mode-ext-class 'jsp-html-helper-mode "\\.jsp\\'" 'jsp)
(mmm-add-mode-ext-class 'jsp-html-helper-mode "\\.jsp\\'" 'html-js)
(mmm-add-mode-ext-class 'html-helper-mode     "\\.js\\'"  'html-js)

and now I can have both JavaScript and Java in my JSP files.  I did have to 
change mmm-sample.el to use the javascript-generic-mode (defined in 
generic-x.el) and I also needed to fix html-helper-mode to use lowercase 
<script> and </script> tags so as not to confuse mmm-mode, but hey, that's 
simple stuff.

Cheers,
Karel

 -----Original Message-----
From: Galen Boyer [mailto:address@hidden
Sent: Friday, December 06, 2002 15:18
To: address@hidden
Subject: [h-e-w] Re: Emacs and JSP


On Fri, 6 Dec 2002, address@hidden wrote:
> Hi Eli and all,
>
> It's not mmm-mode but the older multi-mode (available in the
> emacs archives).  I tried to use mmm-mode but also stumbled
> over the customizations needed.  When Galen mentioned
> multi-mode earlier this week, I thought he referred to mm-mode,
> but then found out multi-mode has been in existence for years
> and indeed does the job nicely (if you customize
> global-semantic-show-unmatched-syntax-mode to nil so senator
> will not annoy you with red underlines in the html code).
>
> Mind you, if you *do* get mmm-mode working for jsp files I'm
> more than interested to know the sordid details.

Does this help?

(mmm-add-group 'jsp
               `((jsp-code
                  :submode jde-mode
                  :match-face (("<%!" . mmm-declaration-submode-face)
                               ("<%=" . mmm-output-submode-face)
                               ("<%"  . mmm-code-submode-face))
                  :front "<%[!=]?"
                  :back "%>"
                  :insert ((?% jsp-code nil @ "<%" @ " " _ " " @ "%>" @)
                           (?! jsp-declaration nil @ "<%!" @ " " _ " " @ "%>" @)
                           (?= jsp-expression nil @ "<%=" @ " " _ " " @ "%>" @))
                  )
                 (jsp-directive
                  :submode text-mode
                  :face mmm-special-submode-face
                  :front "<%@"
                  :back "%>"
                  :insert ((?@ jsp-directive nil @ "<%@" @ " " _ " " @ "%>" @))
                  )))

(setq mmm-mode-ext-classes-alist nil)
(add-to-list 'mmm-mode-ext-classes-alist '(nil "\\.asp\\'" asp-code))
(add-to-list 'mmm-mode-ext-classes-alist '(nil "\\.jsp\\'" jsp-code))
(add-to-list 'mmm-mode-ext-classes-alist '(nil "\\.js\\'" html-js))

--
Galen Boyer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]