Marvin Minsky's The Emotion Machine is on my ever-growing list of books to read.
Again, I haven't read the book yet, but Minsky argues that emotions are "states" of thinking. If you think of your brain as a finite state machine, he believes your brain puts you in the "angry" state or the "distraught" state because it is advantageous for you to be in that state at that time.
He also argues that we should be able to build artificial intelligences with emotions by applying the same techniques to the AI's thought model.
This would probably be much more difficult if the hypothetical AI was primarily emergent, rather than "designed." But an emergent AI may or may not inherently have emotions.
In Minsky papers that I have read, he also theorises that emotions are not the "turning on" that we intuitively think of them as (e.g. you "become" angry), but rather the turning off of certain processing centres of the brain. This explains why people in emotional states are considered less rational.