If a derailleur cable snaps on a long ride, how can I keep going?
"Nothing is so broken you cannot make it worse" - breaking a perfectly good chain in the field, miles from nowhere, with a light weight emergency tool, would be my very last resort.  

This will only work if the broken end is not too frayed. Remove the cable completely from the outers and the shifter. Thread the cable though the barrel adjuster on the dérailleur so that shifter end of the cable is butted against the adjuster. Clamp the cable onto the dérailleur (as you normally do, just with a  very long tail) with the dérailleur in a compromise position (usually middle of cluster, but towards the big cogs if you have hills to climb, and little cogs if you have lots of flat ground.) Adjust dérailleur with the barrel till its sitting on the chosen cog.  Cable tie/tape the remainder of the cable safely out the way (this is really important.....) - its unlikely you have have anything capable of cutting the cable so do not try.  

If you cannot thread the cable, you my get away using something else - a cable tie, a piece of string or binding wire may be able to be used - whatever comes to hand. 

This will leave you with a 2 or 3 speed bike using the front dérailleur - much better than single speeding it and a lot easier than breaking the chain.  

Chain breaking to make a single speed is still an option if these attempts fail.  

Edit : Feeling ingenious - if you are lucky and the cable and outers can be reconfigured......
If you have a separate shifter, and the cable is broken close to the dérailleur, you could remove the shifter from the handle bars, and clamp/tape/cable tie it onto the seat post. Rearrange the cable outers, connect the cable back up to the dérailleur, giving you a full range of gears - although shifting won't be as easy.