Loading ...
Sorry, an error occurred while loading the content.

JSP highlighting?

Expand Messages
  • prelude_2_murder
    Hi everyone. I am new to this list (and to me). I have just recently started using me for most things (I love emacs but the size and slowness is just too
    Message 1 of 3 , Mar 26, 2003
    • 0 Attachment
      Hi everyone. I am new to this list (and to me).

      I have just recently started using me for most things (I love emacs
      but the size and slowness is just too much), but I can't get it to
      highlight jsp syntax (html + java within <% %> tags). This is the
      main thing keeping me away from using microemacs for everything.

      Also, I saw your messages about getting html + JavaScript highlighted
      and, when testing on a page, I was glad to find that the latest
      version (Dec-2002) does it when you use <script language="JavaScript">
      but not when using just <script>. Any hints on how to extend the
      highlighting to use that too.

      I am completely new to lisp and such languages, so please be patient
      with me.

      Thanks

      Gabriel
    • Phillips, Steven
      Gabriel, The starting point for this is the existing html file hook (hkhtml.emf) which supports both Visual Basic and Java script hilighting. In the file hook
      Message 2 of 3 , Mar 27, 2003
      • 0 Attachment
        Gabriel,

        The starting point for this is the existing html file hook (hkhtml.emf) which supports both Visual Basic and Java script hilighting. In the file hook you will find the following:

        !force exec-file "hkvb"
        !if $status
        hilight .hilight.html 0x80 "<%" .hilight.vb .scheme.prepro
        hilight .hilight.htmlT 0x80 "<%" .hilight.vb .scheme.prepro
        hilight .hilight.vb 0x80 "%>" .hilight.html .scheme.prepro
        hilight .hilight.html 0x80 "<script\\s +language=VBScript[^>]*>" .hilight.vb .scheme.prepro
        hilight .hilight.vb 0x80 "</script>" 0 .scheme.prepro
        ; indent .hilight.vb b "<" ">"
        !endif
        !force exec-file "hkjava"
        !if $status
        hilight .hilight.html 0x80 "<script\\s +language=javascript[^>]*>" .hilight.java .scheme.prepro
        hilight .hilight.html 0x80 "<script\\s +language=\"javascript\"[^>]*>" .hilight.java .scheme.prepro
        hilight .hilight.java 0x80 "</script>" 0 .scheme.prepro
        hilight .hilight.java 0x80 "</SCRIPT>" 0 .scheme.prepro
        !endif

        While this looks scary its simply swapping hilighting schemes when certain tags are met, currently when <% is encountered it swaps to Visual Basic rather than java and a simple <script> is not handled as in html the language must be given.

        Do jsp files have a '.jsp' extension?

        From my understanding I would copy hkhtml.emf to hkjsp.emf and replace html with jsp, rip out any references to vb and modify the above tokens to swap to java on the <% and <script> tags.

        You then need to add a hook into me.emf to use your new fhook-jsp when a jsp file is loaded (look for fhook-html - strictly speaking you should add this to your user Setup File in user-setup).

        Lastly it would be good if you could submit your changes back to me so I can wrap it into the next release of ME! It would help me if you could include a suitable JSP example so I can check the file hook etc.

        If you get stuff drop me an email (with a JSP example!)

        Steve

        > -----Original Message-----
        > From: prelude_2_murder [mailto:prelude_2_murder@...]
        > Sent: 26 March 2003 11:58
        > To: jasspa@yahoogroups.com
        > Subject: [jasspa] JSP highlighting?
        >
        >
        > Hi everyone. I am new to this list (and to me).
        >
        > I have just recently started using me for most things (I love emacs
        > but the size and slowness is just too much), but I can't get it to
        > highlight jsp syntax (html + java within <% %> tags). This is the
        > main thing keeping me away from using microemacs for everything.
        >
        > Also, I saw your messages about getting html + JavaScript highlighted
        > and, when testing on a page, I was glad to find that the latest
        > version (Dec-2002) does it when you use <script language="JavaScript">
        > but not when using just <script>. Any hints on how to extend the
        > highlighting to use that too.
        >
        > I am completely new to lisp and such languages, so please be patient
        > with me.
        >
        > Thanks
        >
        > Gabriel
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        > ---------------------~-->
        > Get 128 Bit SSL Encryption!
        > http://us.click.yahoo.com/xaxhjB/hdqFAA/xGHJAA/89EolB/TM
        > --------------------------------------------------------------
        > -------~->
        >
        > ______________________________________________________________
        > ____________
        >
        > This is an unmoderated list. JASSPA is not responsible for
        > the content of
        > any material posted to this list.
        >
        > To unsubscribe, send a mail message to
        >
        > mailto:jasspa-unsubscribe@yahoogroups.com
        >
        > or visit http://groups.yahoo.com/group/jasspa and
        > modify your account settings manually.
        >
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        http://docs.yahoo.com/info/terms/
      • first last
        Thanks for your answer. By now I have (mostly) got it right myself. I am not afraid of changing things around, I just don t understand even a little about
        Message 3 of 3 , Mar 27, 2003
        • 0 Attachment
          Thanks for your answer. By now I have (mostly) got it right myself. I
          am not afraid of changing things around, I just don't understand even a
          little about Lisp.

          Your solution is better, but what I did was:

          What I did was in me.emf added .jsp to the extensions for the html
          mode, as jsp pages are just html pages with embedded java.

          Added "<script>" "<%" to the "openers" of the java section (if that is
          the right term), as it is already done for JavaScript and "%>" for the
          end ("</script>" is already there) in hkhtml.emf.

          Now, the only problem I have is that autoindenting doesn't seem to work
          on either of them (javascript or java code). I'm completely lost in
          there, so any help would be welcome.

          Should I post a copy of this to the list?

          Thanks very much for your help, I will email you the changes when I
          have done them (I have two deadlines tomorrow, so I am far too busy to
          sit down and write something clean, I'll have to live with my hack for
          now).

          Gabriel


          __________________________________________________
          Do You Yahoo!?
          Everything you'll ever need on one web page
          from News and Sport to Email and Music Charts
          http://uk.my.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.