I'm pretty sure that your computer will automatically be put to sleep before the battery completely dies... if it's asleep, you don't lose anything. If you can't plug it in before the battery dies while it's asleep, your current session will have already been written to the harddrive, and your computer will go into 'deep sleep', so when you finally plug it in, everything will be restored... so short story, unless you disabled deep sleep (like I did), I'm pretty sure you won't lose your current session.