How does this automatic emergency LED work?
The quiscent current through the LM317 (from its input to its ADJ pin) is what pulls the base of T2 toward ground.

Note that the datasheet gives this current as 50 &micro;A typical, 100 &micro;A max &mdash; and doesn't specify a minimum value at all.

This means that there's no guarantee that there will be enough base current to turn T2 fully on. For a typical \$h_{FE}\$ value of 100 (BD140 datasheet), this means that LEDs can only draw between 5 and 10 mA.

It would be a good idea to add a resistor from the regulator input to ground in order to supply more current to the transistor when the mains power is off. If those are 20 mA LEDs, you'll want to be able deliver a total of about 240 mA, so you'll need a base current of at least 2.4 mA. With a 6-volt battery, you'll need a total resistance of about 2200 &Omega;. Since R15 is already 1000 &Omega;, your additional resistor should be 1200 &Omega;.

When the line power is on, this resistor will have 9 V &times; 1.414 = 12 V across it, so it will need to dissipate \$\frac{(12 V)^2}{1200 \Omega} = 120 mW\$, so make sure you use a 1/4 W resistor.