I am trying to modify the .jsf syntax highlighting file for the joe editor /usr/share/joe/syntax/ini.jsf. This file contains rules for highlithing/coloring ini files. For ini files, anything after ";" should be a comment.

; comment
key = value ; comment

the above works OK, and joe colors everything after ";" green. However, id does not work correctly in following case:

key = value             ; comment

In other words, it only works when there is only one space in front of the ";". I would like to fix this, but I am struggling with the syntax file structure. Following is a snippet of the relevant part of /usr/share/joe/syntax/ini.jsf:

:line_start Idle
    *               key             noeat
    "\n"            line_start
    " \t\r"         line_start # leading spaces
    ";#"            line_comment    recolor=-1

:line_comment Comment
    *               line_comment
    "\n"            line_start

Can somebody please suggest how to make the necessary modification?

  • Only the snippet works as expected (You can try.). May be another rule overrides this. – taliezin Mar 11 '15 at 13:33
  • This section is not the relevant one, since it handles only comments at line start but not after a key-value pair. May I suggest you a look at github.com/cmur2/joe-syntax/blob/master/ini.jsf which definetly works (Disclaimer: written by me). – cmur2 Mar 11 '15 at 20:10
  • @cmur2 - thanks for the link. But this is exactly the version of ini.jsf which I already have (shipped with joe 3.7-2.3 in Debian Wheezy). And AFAICT, it definitely does not work. (i.e. the coloring works OK with spaces, but not with TABS). – Martin Vegter Mar 11 '15 at 21:20
  • Ah, okay, yea it's only working with spaces but stackoverflow only shows spaces above. Will fix that at least in my repo. – cmur2 Mar 11 '15 at 21:23
  • @cmur2 - thanks a lot. Actually, I am using ini.jsf to colorize asterisk config files. They are very similar to ini files, but not quite the same (for example, they are using key = value, as well as key => value). Would you perhaps be interested to create a proper asterisk.ini syntax file ? – Martin Vegter Mar 11 '15 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.