Subject: bug#18405: 24.3.93; bat-mode.el

From: Achim Gratz <[email-masked]>
Date: Thu, 04 Sep 2014 20:44:50 +0200

In GNU Emacs 24.3.93.1 (i686-pc-linux-gnu, GTK+ Version 3.12.2)
 of 2014-08-24 on Rainer.invalid
Windowing system distributor `The X.Org Foundation', version 11.0.11403901
System Description:	openSUSE 13.1 (Bottle) (i586)

The fontlock pattern for environment variables ins bat-mode.el is

        ("%\\(\\w+\\)%?"
         (1 font-lock-variable-name-face))
        ("!\\(\\w+\\)!?"                ; delayed-expansion !variable!
         (1 font-lock-variable-name-face))

For CMD.EXE at least from Windows 7 onward (I've also tested with the
cmd.exe that comes with Wine), the name of an environment variable can
actually be any character including shell special characters (which
you'd then have to quote separately).  While it's possible to define a
variable that has a "%" character in its name, it can not be used it in
cmd itself since it never gets expanded, so the easiest replacement
pattern would be

        ("%\\([^%]+\\)%?"
         (1 font-lock-variable-name-face))
        ("!\\([^!%]+\\)!?"                ; delayed-expansion !variable!
         (1 font-lock-variable-name-face))

I've noticed this discrepancy when using variables with underscores in
their name, which only fontified the part up to the first underscore
correctly.

Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds