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

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

[JDEE + MMM-Mode + JSP] Java indentation in JSP files


From: Kai Grossjohann
Subject: [JDEE + MMM-Mode + JSP] Java indentation in JSP files
Date: 4 Sep 2003 03:08:12 -0700

Hitting TAB on lines 2 through 4 in the following example gives me no
indentation for any line.  (Each line stays flush left.)

<%
if (true) {
System.out.println("foo");
}
%>

I snarfed the following setup from the Web for using mmm-mode with
JDEE to edit *.jsp files:

(require 'mmm-mode)
(require 'mmm-sample)
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . html-mode))
(setq mmm-global-mode 'maybe)
(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 @ "<%@" @ " " _ " " @
"%>" @))
                  )))
(add-to-list 'mmm-mode-ext-classes-alist '(nil "\\.jsp\\'" jsp-code))

The above works well for syntax highlighting.  Maybe it is too
simple-minded?  Can it be improved such that indentation works?

(C-h c TAB tells me that TAB indeed invokes c-indent-command when I
hit it on one of the Java lines in the *.jsp file.  This is the same
binding as in a *.java file.)


reply via email to

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