M-x all-things-emacs

Quick Tip: Highlighting Java .properties Files

March 1st, 2007 by Rob Christie · 1 Comment

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

Before conf-quote-normal

After

After conf-quote-normal

Tags: java · quick · tips

1 response 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)