Sooo.. noboday actually came back home by himself? Well, I did. when my pull cabel snapped i fixed it. 1st of all NEVER go out without your trusty Leatherman. Then you look around, even on your bike, (but i was lucky to roll to a parking lot, and very often somebody will have something) to find a nut, say M5 or even M4. Then you hammer it flat on the end of the line, and goign easy on the throttle you go back home. It helps to kind of "splti" the end of the cable to create a kind of "bundle" at the end, as the cable may want to slip out. This way it "jams".
it got me home no problem, and I invented it on the spot.
On the other hand, for ecery long trip you should take a cable repair set. You can buy it in bike shops. It contains cables and screw-in ends. Actually those ends would do the trick, and they weight nothing! You could strap them in somewhere in the bike.... now, this is an idea!