Slashdot Mirror


Editors and Java Server Page Synax Highlighting

Nathan Frund asks: "VIM has been my mainstay for writing code/HTML/config files etc for a long time. But VIM doesn't hightlight JSP syntax. I've become accustomed to the syntax highlighting and can't go back to not having it. I've tried various modes for VIM but none of them really do the trick. XEmacs doesn't support it either (I haven't found where it does or even the resources to make it highlight jsp syntax) and I really don't have the time to become a VIM or an Emacs expert to write the modes from scratch. My question to all of you, What editor(s) are you using to write Java Server Pages? "

2 of 8 comments (clear)

  1. mmm.el by Ledge+Kindred · · Score: 2
    From the comments section:

    ;; Author: Gongquan Chen

    ;; This file implements a XEmacs lisp extension
    ;; that allows multiple major modes
    ;; to co-exist in a single buffer. It's a
    ;; workable, yet imperfect, solution that
    ;; basically supports key bindings and font-lock
    ;; in those regions with a secondary
    ;; major mode. To activate one secondary major
    ;; mode, simply add a hook to the
    ;; primary major mode's hook. For details, see
    ;; defun `mmm-activator'.

    Unfortunately, it's pretty big to try to actually post as a comment and there's no URL in the comments of the LISP file. You'll probably have to search through something like Altavista for 'mmm.el' or search on Deja.com or just write the author and see where you can pick up a copy.

    I use it myself for about a year or so with XEmacs (It requires a 21.x version to work correctly) and it works about 99% perfectly with HTML and whichever scripting language I happen to be embedding. (It actually uses a major-mode for the scripting language, so for JSP, the "primary major mode" is HTML except when your cursor is inside <java> tags in which case mmm switches to JDE mode.)

    There are a few global settings, like TABs I think, that it doesn't change because the "primary major mode" sets them globally and they won't get changed when you enter the "secondary major mode" but they're really pretty minor issues. (Pardon the pun.)

    The main drawback is you will have to learn a *little* bit of LISP hacking to set up the filters to let mmm know when to switch modes, but there are enough examples in the comment section of mmm.el that you can pretty much just cut-n-paste to get it to work for your particular situation.

    -=-=-=-=-

    --

    -=-=-=-=-
    My mom's going to kick you in the face!

    1. Re:mmm.el by Ledge+Kindred · · Score: 2
      Dangit ... /. stripped out the EMail address of the author 'coz of the brackets:

      Gongquan Chen (chen@posc.org)

      -=-=-=-=-

      --

      -=-=-=-=-
      My mom's going to kick you in the face!