M-x all-things-emacs

Quick Tip: Highlighting Java .properties Files

March 1st, 2007 by Rob Christie · 4 Comments

Java .properties files are normally formatted using conf-javaprop-mode. Recently, I was frustrated because a single quote in a property was highlighted such that multiple lines were colored like a string until there was another quote on another line. I decided I was going to fix it… It turns out that I didn’t have to look far. C-h f conf-javaprop-mode led me to read about conf-mode which led to finding the command conf-quote-normal. This command sets the syntax of ‘ and “ to punctuation. This is the joy of using emacs. It’s the little things. My new .emacs snippet follows:

(add-hook 'conf-javaprop-mode-hook 
          '(lambda () (conf-quote-normal nil)))


Before conf-quote-normal


After conf-quote-normal

Tags: java · quick · tips

4 responses so far ↓

  • 1 Ryan McGeary // Feb 24, 2007 at 5:13 pm

    By default, conf-quote-normal is also bound to C-c ' in case you only want to enable it once for a current buffer.

    (bound to C-c " and C-c C-q too)

  • 2 Car Speakers - Best Car Speakers,Subwoofers & Audio System // Jul 1, 2015 at 7:50 pm

    ... [Trackback]

    [...] Read More: emacsblog.org/2007/03/01/quick-tip-highlighting-java-properties-files/ [...]

  • 3 security systems // Jul 2, 2015 at 3:48 am

    ... [Trackback]

    [...] Read More here: emacsblog.org/2007/03/01/quick-tip-highlighting-java-properties-files/ [...]

  • 4 innertradingcircle // Jul 2, 2015 at 10:43 am

    ... [Trackback]

    [...] Read More here: emacsblog.org/2007/03/01/quick-tip-highlighting-java-properties-files/ [...]